ACE3/addons/common/functions/fnc_muteUnit.sqf

38 lines
855 B
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
* Author: commy2
* Mutes the unit. It won't trigger auto generated chat messages either.
*
2015-09-18 19:46:21 +00:00
* Arguments:
* 0: Unit <OBJECT>
* 1: Reason to mute the unit <STRING>
*
* Return Value:
* None
*
* Example:
* [bob, "because"] call ace_common_fnc_muteUnit
*
2015-09-18 19:46:21 +00:00
* Public: Yes
*/
2015-09-18 19:46:21 +00:00
params ["_unit", "_reason"];
if (isNull _unit) exitWith {};
2015-04-11 13:46:41 +00:00
// add reason to mute to the unit
private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []];
2015-04-11 13:46:41 +00:00
if !(_reason in _muteUnitReasons) then {
_muteUnitReasons pushBack _reason;
_unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true];
};
private _speaker = speaker _unit;
2015-04-11 13:46:41 +00:00
if (_speaker == "ACE_NoVoice") exitWith {};
[QGVAR(setSpeaker), [_unit, "ACE_NoVoice"]] call CBA_fnc_globalEvent;
_unit setVariable ["ACE_OriginalSpeaker", _speaker, true];