diff --git a/addons/noradio/CfgEventhandlers.hpp b/addons/noradio/CfgEventhandlers.hpp index b9248ac888..d960e896df 100644 --- a/addons/noradio/CfgEventhandlers.hpp +++ b/addons/noradio/CfgEventhandlers.hpp @@ -1,6 +1,6 @@ class Extended_PostInit_EventHandlers { class ADDON { - clientInit = "QUOTE(call COMPILE_FILE(XEH_post_initClient)); - serverInit = "QUOTE(call COMPILE_FILE(XEH_post_initServer)); + clientInit = QUOTE(call COMPILE_FILE(XEH_post_initClient)); + serverInit = QUOTE(call COMPILE_FILE(XEH_post_initServer)); }; }; \ No newline at end of file diff --git a/addons/noradio/XEH_post_initClient.sqf b/addons/noradio/XEH_post_initClient.sqf index ba21ba5f34..fcdeeec7e3 100644 --- a/addons/noradio/XEH_post_initClient.sqf +++ b/addons/noradio/XEH_post_initClient.sqf @@ -2,19 +2,24 @@ #include "script_component.hpp" -0 spawn { - waitUntil {!isNull AGM_player}; +_setupPlayer = { + if (!isNull ACE_player) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; - [AGM_player] call AGM_Core_fnc_muteUnit; - AGM_player setVariable [QGVAR(isMuted), true, true]; + [ACE_player] call EFUNC(common,muteUnit); + ACE_player setVariable [QGVAR(isMuted), true, true]; + }; }; +[_setupPlayer, 0, []] call CBA_fnc_addPerFrameHandler; + [missionNamespace, "playerChanged", { - [_this select 0] call AGM_Core_fnc_muteUnit; + //On player change, mute old unit and unmute new player + [_this select 0] call EFUNC(common,muteUnit); (_this select 0) setVariable [QGVAR(isMuted), true, true]; - if (!((_this select 1) getVariable ["AGM_isUnconscious", false]) && {alive (_this select 1)}) then { - [_this select 1] call AGM_Core_fnc_unmuteUnit; + if (!((_this select 1) getVariable ["ACE_isUnconscious", false]) && {alive (_this select 1)}) then { //@todo: ACE_isUnconscious??? + [_this select 1] call EFUNC(common,unMuteUnit); }; (_this select 1) setVariable [QGVAR(isMuted), false, true]; -}] call AGM_Core_fnc_addCustomEventHandler; +}] call EFUNC(common,addCustomEventHandler);