Fix nils in array

This commit is contained in:
PabstMirror 2016-05-14 13:08:58 -05:00
parent e4c86a8af5
commit 7628f9a4ab

View File

@ -389,12 +389,18 @@ GVAR(OldIsCamera) = false;
// we don't want to trigger this just because your ammo counter decreased.
_data = + GVAR(OldPlayerInventory);
(_data param [0, []]) set [4, primaryWeaponMagazine ACE_player];
(_data param [0, []]) set [5, nil];
(_data param [1, []]) set [4, secondaryWeaponMagazine ACE_player];
(_data param [1, []]) set [5, nil];
(_data param [2, []]) set [4, handgunMagazine ACE_player];
(_data param [2, []]) set [5, nil];
if (!((_data select 0) isEqualTo [])) then {
(_data param [0, []]) set [4, primaryWeaponMagazine ACE_player];
(_data param [0, []]) set [5, []];
};
if (!((_data select 1) isEqualTo [])) then {
(_data param [1, []]) set [4, secondaryWeaponMagazine ACE_player];
(_data param [1, []]) set [5, []];
};
if (!((_data select 2) isEqualTo [])) then {
(_data param [2, []]) set [4, handgunMagazine ACE_player];
(_data param [2, []]) set [5, []];
};
if !(_data isEqualTo GVAR(OldPlayerInventoryNoAmmo)) then {
GVAR(OldPlayerInventoryNoAmmo) = _data;
["playerInventoryChanged", [ACE_player, GVAR(OldPlayerInventory)]] call FUNC(localEvent);