Skip to content

Commit

Permalink
Merge pull request #4289 from acemod/earlyAddPlayerEventHandler
Browse files Browse the repository at this point in the history
Fix null ace_player from early call to addPlayerEH
  • Loading branch information
thojkooi authored Aug 27, 2016
2 parents 34b8686 + 3f34308 commit 1366a6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ enableCamShake true;
// Set up numerous eventhanders for player controlled units
//////////////////////////////////////////////////

// It is possible that CBA_fnc_addPlayerEventHandler has allready been called and run
// We will NOT get any events for the initial state, so manually set ACE_player
if (!isNull (missionNamespace getVariable ["cba_events_oldUnit", objNull])) then {
INFO("CBA_fnc_addPlayerEventHandler has already run - manually setting ace_player");
ACE_player = cba_events_oldUnit;
};

// "playerChanged" event
["unit", {
ACE_player = (_this select 0);
Expand Down
5 changes: 5 additions & 0 deletions addons/noradio/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ if (isServer) then {

if (!hasInterface) exitWith {};

// Handle early CBA_fnc_addPlayerEventHandler
if (!isNull ace_player) then {
[ace_player, "isPlayer"] call EFUNC(common,muteUnit);
};

// mutes/unmutes units when the player changes
["unit", {
params ["_newPlayer", "_oldPlayer"];
Expand Down

0 comments on commit 1366a6f

Please sign in to comment.