diff --git a/dayz_code/actions/trade_items.sqf b/dayz_code/actions/trade_items.sqf index 8e830a31a..2dce7e421 100644 --- a/dayz_code/actions/trade_items.sqf +++ b/dayz_code/actions/trade_items.sqf @@ -95,11 +95,6 @@ if (_bulkqty >= 1) then { }; }; - - - - - cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; dayzTradeResult = nil; @@ -109,31 +104,43 @@ if (_bulkqty >= 1) then { _qty = {_x == _part_in} count magazines player; + if (_qty >= _qty_in) then { - ["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure; - - diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject]; - - waitUntil {!isNil "dayzTradeResult"}; - - if(dayzTradeResult == "PASS") then { - diag_log format["DEBUG Complete Trade: %1", dayzTradeResult]; - for "_x" from 1 to _qty_in do { - player removeMagazine _part_in; - }; - for "_x" from 1 to _qty_out do { - player addMagazine _part_out; - }; + if(_bos == 0) then { + _qty = 1; + }; + + // trade all items + for "_x" from 1 to _qty do { + + ["dayzTradeObject",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure; + + diag_log format["DEBUG Starting to wait for answer: %1", dayzTradeObject]; + + waitUntil {!isNil "dayzTradeResult"}; + + if(dayzTradeResult == "PASS") then { + diag_log format["DEBUG Complete Trade: %1", dayzTradeResult]; + for "_x" from 1 to _qty_in do { + player removeMagazine _part_in; + }; - // [player,"repair",0,false] call dayz_zombieSpeak; - cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; - } else { - cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"]; + for "_x" from 1 to _qty_out do { + player addMagazine _part_out; + }; + + // [player,"repair",0,false] call dayz_zombieSpeak; + cutText [format[("Traded %1 %2 for %3 %4"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"]; + } else { + cutText [format[("Insufficient Stock %1"),_textPartOut] , "PLAIN DOWN"]; + }; + }; dayzTradeResult = nil; + } else { _needed = _qty_in - _qty; cutText [format[("Need %1 More %2"),_needed,_textPartIn] , "PLAIN DOWN"];