From 2e537455b7a6d273bc675b327daa64adc9bbe29a Mon Sep 17 00:00:00 2001 From: Valmo Trindade Date: Sun, 4 Aug 2024 18:12:49 -0300 Subject: [PATCH] ADded handling for multiplayer or singleplayer sessions on init function --- .../{map => }/api/fn_postGeoObject.sqf | 0 .../{map => }/api/fn_putGeoObject.sqf | 0 addons/main/functions/fn_init.sqf | 26 ++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) rename addons/main/functions/{map => }/api/fn_postGeoObject.sqf (100%) rename addons/main/functions/{map => }/api/fn_putGeoObject.sqf (100%) diff --git a/addons/main/functions/map/api/fn_postGeoObject.sqf b/addons/main/functions/api/fn_postGeoObject.sqf similarity index 100% rename from addons/main/functions/map/api/fn_postGeoObject.sqf rename to addons/main/functions/api/fn_postGeoObject.sqf diff --git a/addons/main/functions/map/api/fn_putGeoObject.sqf b/addons/main/functions/api/fn_putGeoObject.sqf similarity index 100% rename from addons/main/functions/map/api/fn_putGeoObject.sqf rename to addons/main/functions/api/fn_putGeoObject.sqf diff --git a/addons/main/functions/fn_init.sqf b/addons/main/functions/fn_init.sqf index f5d922c..bfa3cbb 100644 --- a/addons/main/functions/fn_init.sqf +++ b/addons/main/functions/fn_init.sqf @@ -18,17 +18,29 @@ if (_activated) exitWith { missionNamespace setVariable ["_atak_server_instance", _atak_fts_fulladdress]; missionNamespace setVariable ["_atak_server_instance_token", _atak_fts_bearer_token]; - { - [{ - _uid = _x getVariable "_atak_uid"; + if (isMultiplayer) then { + { + [{ + _uid = _x getVariable "_atak_uid"; - if (isNull _uid) then { - _x call armatak_fnc_postGeoObject; + if (_uid == "") then { + _x call armatak_fnc_postGeoObject; + } else { + _x call armatak_fnc_putGeoObject; + }; + }, 2, []] call CBA_fnc_addPerFrameHandler; + } forEach playableUnits; + } else { + [{ + _uid = player getVariable "_atak_uid"; + + if (_uid == "") then { + player call armatak_fnc_postGeoObject; } else { - _x call armatak_fnc_putGeoObject; + player call armatak_fnc_putGeoObject; }; }, 2, []] call CBA_fnc_addPerFrameHandler; - } forEach playableUnits; + } private _warning = format ["ARMATAK
%1", "Connected!"]; [[_warning, 1.5]] call CBA_fnc_notify;