ACE3/addons/common/functions/fnc__handleSyncedEvent.sqf

38 lines
915 B
Plaintext
Raw Normal View History

/*
* Author: jaynus
2015-04-18 02:26:27 +00:00
* Handles synced events being received. Server will log them, and server/client will execute them.
*
2015-04-18 02:26:27 +00:00
* Arguments [Client] :
2015-09-18 05:42:10 +00:00
* 0: eventName <STRING>
* 1: arguments <ARRAY>
2016-01-29 00:19:02 +00:00
* 2: ttl <NUMBER>
2015-09-18 05:42:10 +00:00
*
* Return Value:
* Boolean of success <BOOL>
*
2015-09-18 05:42:10 +00:00
* Public: No
*/
#include "script_component.hpp"
2015-09-18 05:42:10 +00:00
params ["_name", "_args", "_ttl"];
if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
ACE_LOGERROR("Synced event key not found.");
false
};
private _internalData = HASH_GET(GVAR(syncedEvents),_name);
2015-09-18 05:42:10 +00:00
if (isServer) then {
// Server needs to internally log it for synchronization
2015-09-18 05:42:10 +00:00
if (_ttl > -1) then {
_internalData = HASH_GET(GVAR(syncedEvents),_name);
2015-09-18 05:42:10 +00:00
_internalData params ["", "_eventLog"];
2015-11-30 16:21:28 +00:00
_eventLog pushBack [ACE_diagTime, _args, _ttl];
};
};
_internalData params ["_eventCode"];
_args call _eventCode;