Fix for empty _Primary array

This commit is contained in:
He-Man 2017-10-07 17:45:19 +02:00
parent 7ef339d958
commit 4660975b05

View File

@ -214,6 +214,7 @@ if (!isNull _player) then {
// Workaround for Client / Server synchronizing issue in unitloadout // Workaround for Client / Server synchronizing issue in unitloadout
_Primary = _loadout select 0; _Primary = _loadout select 0;
if !(_Primary isequalto []) then {
_loadout set [0,[]]; _loadout set [0,[]];
_newPlyr setunitloadout _loadout; _newPlyr setunitloadout _loadout;
_primaryweapon = _Primary deleteat 0; _primaryweapon = _Primary deleteat 0;
@ -229,6 +230,10 @@ if (!isNull _player) then {
_newPlyr addPrimaryWeaponItem _x; _newPlyr addPrimaryWeaponItem _x;
}; };
} forEach _Primary; } forEach _Primary;
}
else {
_newPlyr setunitloadout _loadout;
};
diag_log format["DEBUG: loaded player %1 with new schema Version %2", _newPlyr, _schemaVersion]; diag_log format["DEBUG: loaded player %1 with new schema Version %2", _newPlyr, _schemaVersion];