Prevent purchasing negative number of items

Fixes mistake from ffef031 @icomrade . _amount here is the quantity the
player enters in the quantity box when buying. The only time it is less
than or equal to zero is if the player enters zero or a negative number.
It has nothing to do with the buy or sell price.

Thanks Sercan for reporting.
This commit is contained in:
ebaydayz
2017-01-01 18:32:20 -05:00
parent e4aeee37fd
commit 5cb485ccfb
2 changed files with 3 additions and 6 deletions

View File

@@ -40,6 +40,7 @@
[FIXED] Base objects duplicating when using "take ownership" on plot pole. #1811 @BNG-Lance @Clanwarfare
[FIXED] Unable to sell some launchers like Javelin and Stinger which have the same classname for ammo and weapon. #1844 @ndavalos
[FIXED] Long search delay when filling water bottles, drinking from hands and drinking from empty cans on Chernarus. #1835 @schwanzkopfhegel
[FIXED] Players can not purchase a negative number of items anymore.
[NOTE] The fixes below are included in the 1.0.6 Build C server package released December 29th, 2016 (http://dayzepoch.com/a2dayzepoch.php)
[FIXED] Hive child 309 errors that resulted in broken saving of newly built storage object inventory. @icomrade

View File

@@ -3,15 +3,11 @@ private ["_amount","_index","_index2","_temp"];
_index = _this select 0;
_amount = parseNumber(_this select 1);
if (!isNil "_index" && {_index > -1} && {typeName _amount == "SCALAR"}) then {
if (!isNil "_index" && {_index > -1} && {typeName _amount == "SCALAR"} && {_amount > 0}) then {
_temp = [] + (Z_BuyableArray select _index);
_temp set [9,(ceil _amount)];
Z_BuyingArray set [count(Z_BuyingArray),_temp];
if (_amount > 0) then {
_index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];
} else {
_index2 = lbAdd [Z_AT_BUYINGLIST, localize "STR_EPOCH_TRADE_NOT_SELLING"];
};
_index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];
lbSetPicture [Z_AT_BUYINGLIST, _index2, _temp select 4];
call Z_calcPrice;
};