From 5cb485ccfbaa9a32716e857fea6626977ba49c6b Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Sun, 1 Jan 2017 18:32:20 -0500 Subject: [PATCH] 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. --- CHANGE LOG 1.0.6.1.txt | 1 + .../AdvancedTrading/functions/z_at_toBuyingList.sqf | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGE LOG 1.0.6.1.txt b/CHANGE LOG 1.0.6.1.txt index 90f3812a9..59df1fe3e 100644 --- a/CHANGE LOG 1.0.6.1.txt +++ b/CHANGE LOG 1.0.6.1.txt @@ -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 diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf index 156056846..54054121f 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf @@ -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; };