From b7a54b463c31cb3f665f68a5621474048bdeeaf0 Mon Sep 17 00:00:00 2001 From: Valmo Trindade Date: Tue, 27 Aug 2024 04:38:25 -0300 Subject: [PATCH] refactored init function to work on multiplayer, still facing some problems when trying to send many users/units, will have to deal with it --- addons/main/functions/fn_init.sqf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/main/functions/fn_init.sqf b/addons/main/functions/fn_init.sqf index 099f909..cda2a36 100644 --- a/addons/main/functions/fn_init.sqf +++ b/addons/main/functions/fn_init.sqf @@ -3,6 +3,7 @@ params [ ["_units", [], [[]]], ["_activated", true, [true]] ]; + if (isServer && _activated) exitWith { private _warning = format ["ARMATAK
%1", "Connecting..."]; [[_warning, 1.5]] call CBA_fnc_notify; @@ -22,16 +23,19 @@ if (isServer && _activated) exitWith { _atak_server_instance_token = call armatak_fnc_extract_auth_token; if (isMultiplayer) then { - { + [{ [{ - [_x] call armatak_fnc_postMarker; - [_x] call armatak_fnc_postDroneMarker; + { + private _unit = _x; + _unit call armatak_fnc_postMarker; + _unit call armatak_fnc_postDroneMarker; + } forEach playableUnits; }, 1, []] call CBA_fnc_addPerFrameHandler; - } forEach playableUnits; + }, [], 1] call CBA_fnc_waitAndExecute; } else { [{ - [player] call armatak_fnc_postMarker; - [player] call armatak_fnc_postDroneMarker; + player call armatak_fnc_postMarker; + player call armatak_fnc_postDroneMarker; }, 1, []] call CBA_fnc_addPerFrameHandler; };