From 4660975b05e77ba7c2e346262d9e54d478da206b Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 7 Oct 2017 17:45:19 +0200 Subject: [PATCH] Fix for empty _Primary array --- .../epoch_player/EPOCH_server_loadPlayer.sqf | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf b/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf index 966381e9..cba0e2dd 100644 --- a/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf +++ b/Sources/epoch_server/compile/epoch_player/EPOCH_server_loadPlayer.sqf @@ -214,21 +214,26 @@ if (!isNull _player) then { // Workaround for Client / Server synchronizing issue in unitloadout _Primary = _loadout select 0; - _loadout set [0,[]]; - _newPlyr setunitloadout _loadout; - _primaryweapon = _Primary deleteat 0; - { - if (_x isequaltype []) then { - _newPlyr addMagazine _x; - }; - } foreach _Primary; - _newPlyr addweapon _primaryweapon; - removeAllPrimaryWeaponItems _newPlyr; - { - if (_x isequaltype "") then { - _newPlyr addPrimaryWeaponItem _x; - }; - } forEach _Primary; + if !(_Primary isequalto []) then { + _loadout set [0,[]]; + _newPlyr setunitloadout _loadout; + _primaryweapon = _Primary deleteat 0; + { + if (_x isequaltype []) then { + _newPlyr addMagazine _x; + }; + } foreach _Primary; + _newPlyr addweapon _primaryweapon; + removeAllPrimaryWeaponItems _newPlyr; + { + if (_x isequaltype "") then { + _newPlyr addPrimaryWeaponItem _x; + }; + } forEach _Primary; + } + else { + _newPlyr setunitloadout _loadout; + }; diag_log format["DEBUG: loaded player %1 with new schema Version %2", _newPlyr, _schemaVersion];