ACE3/addons/captives/functions/fnc_handlePlayerChanged.sqf

34 lines
978 B
Plaintext
Raw Normal View History

2015-02-03 02:04:50 +00:00
/*
* Author: commy2
2015-02-06 09:38:27 +00:00
* Handles playerChanged. Resets "showHUD" based on handcuff status
2015-02-03 02:04:50 +00:00
*
* Arguments:
2015-02-06 09:38:27 +00:00
* 0: _newUnit <OBJECT>
2015-02-03 02:04:50 +00:00
* 1: _oldUnit <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
2015-02-06 23:03:56 +00:00
* [bob1, bob2] call ACE_captives_fnc_handlePlayerChange
2015-02-03 02:04:50 +00:00
*
* Public: No
*/
#include "script_component.hpp"
params ["_newUnit","_oldUnit"];
2015-02-03 02:04:50 +00:00
//set showHUD based on new unit status:
2015-02-07 21:20:51 +00:00
if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then {
TRACE_1("Player Change (showHUD false)",_newUnit);
["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud);
2015-02-03 02:04:50 +00:00
} else {
2015-02-07 21:20:51 +00:00
TRACE_1("Player Change (showHUD true)",_newUnit);
2015-10-16 03:45:35 +00:00
["captive", []] call EFUNC(common,showHud); //same as showHud true;
2015-02-03 02:04:50 +00:00
};
//If old player was escorting, stop
if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable [QGVAR(isEscorting), false, true];
};