diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf index dd2339f9..b7cd1940 100644 --- a/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_addItemOverflow.sqf @@ -23,31 +23,28 @@ BOOL */ private ["_wHPos","_wH","_nearByHolder"]; -params [["_item","",[""]],["_count",0]]; - -if (player canAdd _item) then { - if (_count >= 1) then { - player addMagazine [_item, _count]; - } else { +params [["_item","",[""]],["_count",1]]; +for "_i" from 1 to _count do +{ + if (player canAdd _item) then { player addItem _item; - }; -} else { - _wH = objNull; - _nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3]; - if (_nearByHolder isEqualTo []) then { - _wHPos = player modelToWorld [0,1,0]; - if (surfaceIsWater _wHPos) then { - _wHPos = ASLToATL _wHPos; + } else { + _wH = objNull; + if (isNil "_nearByHolder") then { + _nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3]; + }; + if (_nearByHolder isEqualTo []) then { + _wHPos = player modelToWorld [0,1,0]; + if (surfaceIsWater _wHPos) then { + _wHPos = ASLToATL _wHPos; + }; + _wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; + } else { + _wH = _nearByHolder select 0; + }; + if !(isNull _wh) then { + _wh addItemCargoGlobal [_item,1]; }; - _wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; - } else { - _wH = _nearByHolder select 0; - }; - - if (_count >= 1) then { - _wh addMagazineAmmoCargo[_item, 1, _count]; - } else { - _wh addItemCargoGlobal [_item,1]; }; }; true