Skip to content

Commit

Permalink
Moved the check nad used waitUntil in function
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom committed Apr 12, 2024
1 parent 82656e1 commit 9e4a592
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 1 addition & 5 deletions cScripts/functions/gear/fn_gear_applyLoadout.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions cScripts/functions/systems/fn_getArsenalWhitelist.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define DEBUG_MODE
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
Expand All @@ -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);
Expand Down Expand Up @@ -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

0 comments on commit 9e4a592

Please sign in to comment.