ACE3/addons/common/functions/fnc_setVariableJIP.sqf
2015-05-14 20:06:06 +02:00

28 lines
648 B
Plaintext

/*
* Author: commy2
*
* Sets a public object namespace variable that gets reset with the same value after respawn, so JIP clients keep the value.
*
* Argument:
* 0: Object (Object)
* 1: Variable name (String)
* 2: Any value (Anything)
*
* Return value:
* Nothing.
*/
#include "script_component.hpp"
private ["_respawnVariables"];
PARAMS_3(_unit,_varName,_value);
_respawnVariables = _unit getVariable ["ACE_respawnVariables", []];
if !(_varName in _respawnVariables) then {
_respawnVariables pushBack _varName;
_unit setVariable ["ACE_respawnVariables", _respawnVariables, true];
};
_unit setVariable [_varName, _value, true];