-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathfnc_removeBISPlayerEventHandler.sqf
46 lines (34 loc) · 1.24 KB
/
fnc_removeBISPlayerEventHandler.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_removeBISPlayerEventHandler
Description:
Remove event handlers added via CBA_fnc_addBISPlayerEventHandler.
Parameters:
_key - Unique identifier for the event. <STRING>
Returns:
Event was removed <BOOLEAN>
Examples:
(begin example)
["TAG_MyFiredNearEvent"] call CBA_fnc_removeBISPlayerEventHandler
(end)
Author:
LinkIsGrim
---------------------------------------------------------------------------- */
SCRIPT(removeBISPlayerEventHandler);
if (canSuspend) exitWith {
[CBA_fnc_removeBISPlayerEventHandler, _this] call CBA_fnc_directCall;
};
params [
["_key", "", [""]]
];
if (isNil QGVAR(playerEventsHash)) exitWith {false};
_key = format [QGVAR(playerEvents_%1), toLowerANSI _key];
if !(_key in GVAR(playerEventsHash)) exitWith {false};
(GVAR(playerEventsHash) deleteAt _key) params ["_type", "", "_ignoreVirtual"];
private _player = call CBA_fnc_currentUnit;
private _ehIdx = _player getVariable [_key, -1]; // don't touch any events if it wasn't one we added
if (_ehIdx != -1) then {
_player removeEventHandler [_type, _ehIdx];
_player setVariable [_key, nil];
};
true // return