diff --git a/addons/zeus/XEH_preClientInit.sqf b/addons/zeus/XEH_preClientInit.sqf index 2e06ff99..45bf4e8c 100644 --- a/addons/zeus/XEH_preClientInit.sqf +++ b/addons/zeus/XEH_preClientInit.sqf @@ -103,25 +103,32 @@ Drop this anywhere. Toggles Blue Force Tracking.
"; ["loadout", { //current units loadout changed, check radios private _loadout = getUnitLoadout player; - if (((player getVariable [QGVAR(channelSW), -1]) isEqualTo -1) && {!((_loadout select 9 select 2) isEqualTo "")}) then { - [] call FUNC(moduleDiagnosticsGetPlayerFreqsAtStart); - }; + if (_loadout isEqualTo []) exitWith {}; + private _linkedItems = _loadout select 9; + if !(_linkedItems isEqualTo []) then { + if (((player getVariable [QGVAR(channelSW), -1]) isEqualTo -1) && {!(( _linkedItems select 2) isEqualTo "")}) then { + [] call FUNC(moduleDiagnosticsGetPlayerFreqsAtStart); + }; - if (!((player getVariable [QGVAR(channelSW), -1]) isEqualTo -1) && {(_loadout select 9 select 2) isEqualTo ""}) then { - player setVariable [QGVAR(channelSW), nil, true]; - player setVariable [QGVAR(freqSW), nil, true]; - player setVariable [QGVAR(channelAdditionalSW), nil, true]; - player setVariable [QGVAR(freqAdditionalSW), nil, true]; + if (!((player getVariable [QGVAR(channelSW), -1]) isEqualTo -1) && {(_linkedItems select 2) isEqualTo ""}) then { + player setVariable [QGVAR(channelSW), nil, true]; + player setVariable [QGVAR(freqSW), nil, true]; + player setVariable [QGVAR(channelAdditionalSW), nil, true]; + player setVariable [QGVAR(freqAdditionalSW), nil, true]; + }; }; - if (((player getVariable [QGVAR(channelLR), -1]) isEqualTo -1) && {!((_loadout select 5 select 0) isEqualTo "")}) then { - [] call FUNC(moduleDiagnosticsGetPlayerFreqsAtStart); - }; + private _backpack = _loadout select 5; + if !(_backpack isEqualTo []) then { + if (((player getVariable [QGVAR(channelLR), -1]) isEqualTo -1) && {!((_backpack select 0) isEqualTo "")}) then { + [] call FUNC(moduleDiagnosticsGetPlayerFreqsAtStart); + }; - if (!((player getVariable [QGVAR(channelLR), -1]) isEqualTo -1) && {(_loadout select 5 select 0) isEqualTo ""}) then { - player setVariable [QGVAR(channelLR), nil, true]; - player setVariable [QGVAR(freqLR), nil, true]; - player setVariable [QGVAR(channelAdditionalLR), nil, true]; - player setVariable [QGVAR(freqAdditionalLR), nil, true]; + if (!((player getVariable [QGVAR(channelLR), -1]) isEqualTo -1) && {(_backpack select 0) isEqualTo ""}) then { + player setVariable [QGVAR(channelLR), nil, true]; + player setVariable [QGVAR(freqLR), nil, true]; + player setVariable [QGVAR(channelAdditionalLR), nil, true]; + player setVariable [QGVAR(freqAdditionalLR), nil, true]; + }; }; }, true] call CBA_fnc_addPlayerEventHandler;