2017-08-29 22:47:01 +00:00
|
|
|
// By commy2
|
2015-09-26 18:45:19 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2017-08-29 22:47:01 +00:00
|
|
|
// Unmute unit if that player disconnects
|
2015-09-26 18:45:19 +00:00
|
|
|
if (isServer) then {
|
|
|
|
addMissionEventHandler ["HandleDisconnect", {
|
|
|
|
[_this select 0, "isPlayer"] call EFUNC(common,unmuteUnit);
|
|
|
|
}];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
2016-08-24 03:43:37 +00:00
|
|
|
// Handle early CBA_fnc_addPlayerEventHandler
|
|
|
|
if (!isNull ace_player) then {
|
|
|
|
[ace_player, "isPlayer"] call EFUNC(common,muteUnit);
|
|
|
|
};
|
|
|
|
|
2017-08-29 22:47:01 +00:00
|
|
|
// Mutes/unmutes units when the player changes
|
2016-06-21 23:39:20 +00:00
|
|
|
["unit", {
|
2015-09-26 18:45:19 +00:00
|
|
|
params ["_newPlayer", "_oldPlayer"];
|
|
|
|
|
2017-08-29 22:47:01 +00:00
|
|
|
// Mute the new player
|
2015-09-26 18:45:19 +00:00
|
|
|
[_newPlayer, "isPlayer"] call EFUNC(common,muteUnit);
|
|
|
|
|
2017-08-29 22:47:01 +00:00
|
|
|
// Unmute the old player
|
2015-09-26 18:45:19 +00:00
|
|
|
if (alive _oldPlayer) then {
|
|
|
|
[_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit);
|
|
|
|
};
|
2016-06-21 23:39:20 +00:00
|
|
|
}] call CBA_fnc_addPlayerEventHandler;
|