ACE3/addons/common/functions/fnc_removeEventHandler.sqf

24 lines
587 B
Plaintext
Raw Normal View History

2016-05-30 16:37:03 +00:00
/*
* Author: Nou
* Remove an event handler.
*
* Argument:
* 0: Event name <STRING>
* 1: Event code <NUMBER>
*
* Return Value:
* None
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_eventName", "_eventCodeIndex"];
private _eventFunctions = GVAR(eventsLocation) getVariable _eventName;
if (isNil "_eventFunctions") exitWith {TRACE_1("eventName not found",_eventName);};
if ((_eventCodeIndex < 0) || {(count _eventFunctions) <= _eventCodeIndex}) exitWith {TRACE_2("index out of bounds",_eventName,_eventCodeIndex);};
_eventFunctions set [_eventCodeIndex, nil];