From 8439a931e47ccdd07193b08863e90bcbf813ee60 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Fri, 1 Sep 2023 16:52:45 -0400 Subject: [PATCH] Gunbag - Add check for weapon in virtual items on loadout set (#9358) * add check for weapon in arsenal virtual items * fix variable Co-authored-by: BrettMayson * add INFO Co-authored-by: PabstMirror --------- Co-authored-by: BrettMayson Co-authored-by: PabstMirror --- addons/gunbag/XEH_preInit.sqf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/gunbag/XEH_preInit.sqf b/addons/gunbag/XEH_preInit.sqf index 93e79f14a0..ad244390fa 100644 --- a/addons/gunbag/XEH_preInit.sqf +++ b/addons/gunbag/XEH_preInit.sqf @@ -30,6 +30,13 @@ PREP_RECOMPILE_END; params ["_unit", "_loadout", "_extendedInfo"]; private _gunbagWeapon = _extendedInfo getOrDefault [QGVAR(gunbagWeapon), []]; if (_gunbagWeapon isNotEqualTo []) then { + if (!isNil QEGVAR(arsenal,virtualItemsFlatAll)) then { + private _weapon = (_gunbagWeapon select 0) call EFUNC(arsenal,baseWeapon); + if !(_weapon in EGVAR(arsenal,virtualItemsFlatAll)) then { + INFO_1("removing [%1] from loadout",_gunbagWeapon); + _gunbagWeapon = []; + }; + }; (backpackContainer _unit) setVariable [QGVAR(gunbagWeapon), _gunbagWeapon, true]; }; }] call CBA_fnc_addEventHandler;