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,31 +23,28 @@
BOOL BOOL
*/ */
private ["_wHPos","_wH","_nearByHolder"]; private ["_wHPos","_wH","_nearByHolder"];
params [["_item","",[""]],["_count",0]]; params [["_item","",[""]],["_count",1]];
for "_i" from 1 to _count do
if (player canAdd _item) then { {
if (_count >= 1) then { if (player canAdd _item) then {
player addMagazine [_item, _count];
} else {
player addItem _item; player addItem _item;
}; } else {
} else { _wH = objNull;
_wH = objNull; if (isNil "_nearByHolder") then {
_nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3]; _nearByHolder = nearestObjects [position player,["groundWeaponHolder"],3];
if (_nearByHolder isEqualTo []) then { };
_wHPos = player modelToWorld [0,1,0]; if (_nearByHolder isEqualTo []) then {
if (surfaceIsWater _wHPos) then { _wHPos = player modelToWorld [0,1,0];
_wHPos = ASLToATL _wHPos; 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 true