item overflow support for spawning count of items or weapons

This commit is contained in:
vbawol 2016-04-24 17:44:11 -05:00
parent 5744be50d3
commit 14ea6a44dc

View File

@ -23,17 +23,16 @@
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 {
} 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 {
@ -43,11 +42,9 @@ if (player canAdd _item) then {
} else {
_wH = _nearByHolder select 0;
};
if (_count >= 1) then {
_wh addMagazineAmmoCargo[_item, 1, _count];
} else {
if !(isNull _wh) then {
_wh addItemCargoGlobal [_item,1];
};
};
};
true