2015-01-13 23:27:42 +00:00
|
|
|
/*
|
|
|
|
* Author: Nou
|
2015-09-18 06:47:14 +00:00
|
|
|
* Add an event handler.
|
2015-01-13 23:27:42 +00:00
|
|
|
*
|
2015-09-18 06:47:14 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Event name <STRING>
|
|
|
|
* 1: Event code <CODE>
|
2015-01-13 23:27:42 +00:00
|
|
|
*
|
2015-09-18 06:47:14 +00:00
|
|
|
* Return Value:
|
|
|
|
* Event handler ID number (for use with fnc_removeEventHandler) <NUMBER>
|
2015-01-13 23:27:42 +00:00
|
|
|
*
|
2015-09-18 06:47:14 +00:00
|
|
|
* Public: Yes
|
2015-01-13 23:27:42 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
2015-05-14 18:02:42 +00:00
|
|
|
|
2015-09-18 06:47:14 +00:00
|
|
|
params ["_eventName", "_eventCode"];
|
2015-05-14 18:02:42 +00:00
|
|
|
|
2016-02-06 20:18:01 +00:00
|
|
|
private _eventFunctions = GVAR(eventsLocation) getVariable _eventName;
|
2015-01-13 23:27:42 +00:00
|
|
|
|
2016-02-06 20:18:01 +00:00
|
|
|
if (isNil "_eventFunctions") then {
|
|
|
|
_eventFunctions = [];
|
|
|
|
GVAR(eventsLocation) setVariable [_eventName, _eventFunctions];
|
2015-09-18 06:47:14 +00:00
|
|
|
};
|
2015-01-13 23:27:42 +00:00
|
|
|
|
2015-09-18 06:47:14 +00:00
|
|
|
_eventFunctions pushBack _eventCode // Return event function count
|