From 9e4a592b791ccd7c004eda6bc8ab644a7c2425ec Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Fri, 12 Apr 2024 21:16:04 +0200 Subject: [PATCH] Moved the check nad used waitUntil in function --- cScripts/functions/gear/fn_gear_applyLoadout.sqf | 6 +----- cScripts/functions/systems/fn_getArsenalWhitelist.sqf | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cScripts/functions/gear/fn_gear_applyLoadout.sqf b/cScripts/functions/gear/fn_gear_applyLoadout.sqf index 6b9b0d903..7636f6d0b 100644 --- a/cScripts/functions/gear/fn_gear_applyLoadout.sqf +++ b/cScripts/functions/gear/fn_gear_applyLoadout.sqf @@ -91,11 +91,7 @@ _unit selectWeapon (primaryWeapon _unit); if !(weaponLowered _unit) then {_unit action ["WeaponOnBack", _unit]}; if (GVAR(isPlayer)) then { - [{!isNull player && player == player}, { - [QEGVAR(StagingArsenal,SaveWhitelist)] call CBA_fnc_localEvent; - }, [], 5, { - SHOW_SERVER_ERROR_2("Arsenal", "Whitelist creation have failed for %1 [%2]",name player,typeOf player); - }] call CBA_fnc_waitUntilAndExecute; + [QEGVAR(StagingArsenal,SaveWhitelist)] call CBA_fnc_localEvent; }; if (_loadConfig) then { diff --git a/cScripts/functions/systems/fn_getArsenalWhitelist.sqf b/cScripts/functions/systems/fn_getArsenalWhitelist.sqf index 906164d11..bd6d1dff0 100644 --- a/cScripts/functions/systems/fn_getArsenalWhitelist.sqf +++ b/cScripts/functions/systems/fn_getArsenalWhitelist.sqf @@ -1,3 +1,4 @@ +#define DEBUG_MODE #include "..\script_component.hpp"; /* * Author: CPL.Brostrom.A @@ -13,6 +14,8 @@ * call cScripts_fnc_getArsenalWhitelist; */ +waitUntil {!isNull player && player == player}; + private _classname = [player] call EFUNC(gear,getLoadoutName); if !(isClass (missionConfigFile >> "CfgLoadouts" >> _classname)) exitWith { SHOW_CHAT_WARNING_1("ArsenalWhitelist", "Loadout '%1' does not exist inside of mission config. No whitelist will be created.", _classname); @@ -118,4 +121,6 @@ private _launcherSpecific = switch (true) do { private _whitelist = _commonGear + _unitItems + _orgItems + _roleSpecific + _primarySpecific + _handgunSpecific + _launcherSpecific; +INFO_2("Arsenal", "Whitelist created for %1 [%2].",player,typeof player); + _whitelist