From 82656e1d7ac9d7c1268599bf1bdcd1a5cdad4359 Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Fri, 12 Apr 2024 13:41:21 +0200 Subject: [PATCH 1/3] Added possible fix for arsenal whitelist were not created on first load to server --- cScripts/functions/gear/fn_gear_applyLoadout.sqf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cScripts/functions/gear/fn_gear_applyLoadout.sqf b/cScripts/functions/gear/fn_gear_applyLoadout.sqf index 7636f6d0b..6b9b0d903 100644 --- a/cScripts/functions/gear/fn_gear_applyLoadout.sqf +++ b/cScripts/functions/gear/fn_gear_applyLoadout.sqf @@ -91,7 +91,11 @@ _unit selectWeapon (primaryWeapon _unit); if !(weaponLowered _unit) then {_unit action ["WeaponOnBack", _unit]}; if (GVAR(isPlayer)) then { - [QEGVAR(StagingArsenal,SaveWhitelist)] call CBA_fnc_localEvent; + [{!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; }; if (_loadConfig) then { From 9e4a592b791ccd7c004eda6bc8ab644a7c2425ec Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Fri, 12 Apr 2024 21:16:04 +0200 Subject: [PATCH 2/3] 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 From 52f0cd7fdc6d292f520e3ec23477e5728d9cdacb Mon Sep 17 00:00:00 2001 From: Jonah Pool Date: Fri, 12 Apr 2024 15:25:17 -0400 Subject: [PATCH 3/3] Update fn_getArsenalWhitelist.sqf --- cScripts/functions/systems/fn_getArsenalWhitelist.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/cScripts/functions/systems/fn_getArsenalWhitelist.sqf b/cScripts/functions/systems/fn_getArsenalWhitelist.sqf index bd6d1dff0..1c21cd378 100644 --- a/cScripts/functions/systems/fn_getArsenalWhitelist.sqf +++ b/cScripts/functions/systems/fn_getArsenalWhitelist.sqf @@ -1,4 +1,3 @@ -#define DEBUG_MODE #include "..\script_component.hpp"; /* * Author: CPL.Brostrom.A