ACE3/addons/noradio/XEH_post_initClient.sqf

32 lines
896 B
Plaintext
Raw Normal View History

// by commy2
2015-01-14 03:04:25 +00:00
#include "script_component.hpp"
2015-01-14 03:36:53 +00:00
_setupPlayer = {
if (!isNull ACE_player) then {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
2015-01-14 03:36:53 +00:00
[ACE_player] call EFUNC(common,muteUnit);
ACE_player setVariable [QGVAR(isMuted), true, true];
};
};
2015-01-14 03:36:53 +00:00
[_setupPlayer, 0, []] call CBA_fnc_addPerFrameHandler;
// Mutes/unmutes units when the player changes
["playerChanged", {
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
// On player change mute the new player
[_newPlayer] call EFUNC(common,muteUnit);
_newPlayer setVariable [QGVAR(isMuted), true, true];
// Unmute the old player
//@todo: sort interaction with medical system
if (!(_oldPlayer getVariable ["ACE_isUnconscious", false]) && {alive _oldPlayer}) then {
[_oldPlayer] call EFUNC(common,unMuteUnit);
2015-01-14 03:17:34 +00:00
};
_oldPlayer setVariable [QGVAR(isMuted), false, true];
}] call EFUNC(common,addEventhandler);