Skip to content

Commit

Permalink
Fixed Fired EH not removing properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopard20 authored Aug 19, 2018
1 parent 4317b75 commit 193defa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions addons/AIO_AIMENU/setBehaviour.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ AIO_fireOnMyLead =
if ((_currentComm select _i) select 0 == 2) then {(AIO_unitsToHoldFire select _i) doMove ((_currentComm select _i) select 1)};
};
player groupRadio format["SentOpenFire%1",(selectRandom _commStr)];
player removeEventHandler ["fired", AIO_fireOnMyLeadEvent];
[] spawn {
_EH = player getVariable "AIO_fireOnMyLeadEvent";
player removeEventHandler ["fired", _EH];
player setVariable ["AIO_fireOnMyLeadEvent", -1];
};
AIO_unitsToHoldFire = [];
};

Expand Down Expand Up @@ -114,7 +118,11 @@ switch (_mode) do
//player groupRadio "SentCeaseFireInsideGroup";
player groupRadio "SentHoldFireInCombat";
player groupChat (selectRandom _commStr);
AIO_fireOnMyLeadEvent = player addeventhandler ["fired",{_this call AIO_fireOnMyLead}];
_EH = player getVariable ["AIO_fireOnMyLeadEvent", -1];
if (_EH == -1) then {
_EH = player addeventhandler ["fired",{_this call AIO_fireOnMyLead}];
player setVariable ["AIO_fireOnMyLeadEvent", _EH];
};
};
case 3:
{
Expand Down

0 comments on commit 193defa

Please sign in to comment.