ACE3/addons/common/functions/fnc_removeEventHandler.sqf
2016-05-30 18:37:03 +02:00

24 lines
587 B
Plaintext

/*
* 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];