Skip to content

Commit

Permalink
Merge pull request #332 from CBATeam/improve_playereh
Browse files Browse the repository at this point in the history
pass old unit in 'unit' event, disable on HC and dedicated servers
  • Loading branch information
Killswitch00 committed May 18, 2016
2 parents 9a43d4c + 9c0e566 commit 189b7c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addons/events/fnc_addPlayerEventHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Author:
#include "script_component.hpp"
SCRIPT(addPlayerEventHandler);

if (!hasInterface) exitWith {-1};

params [["_type", "", [""]], ["_function", {}, [{}]]];

_type = toLower _type;
Expand Down Expand Up @@ -82,8 +84,8 @@ if (_id != -1) then {
GVAR(playerEHInfo) pushBack addMissionEventHandler ["EachFrame", {
private _player = call CBA_fnc_currentUnit;
if !(_player isEqualTo GVAR(oldUnit)) then {
[QGVAR(unitEvent), [_player, GVAR(oldUnit)]] call CBA_fnc_localEvent;
GVAR(oldUnit) = _player;
[QGVAR(unitEvent), [_player]] call CBA_fnc_localEvent;
};

private _data = currentWeapon _player;
Expand Down

0 comments on commit 189b7c7

Please sign in to comment.