From 9c4e30ea0888b1cbf9f6a61fd2b3c1452d9e0367 Mon Sep 17 00:00:00 2001 From: icomrade Date: Sat, 23 Jul 2016 01:16:37 -0400 Subject: [PATCH] Fix Advanced Trading Selling + new Var New variable to configure whether or not the player will need to key to sell a vehicle. DZE_SaleRequiresKey = false; --- .../AdvancedTrading/functions/z_at_checkArrayInConfig.sqf | 4 ++-- .../actions/AdvancedTrading/functions/z_at_sellItems.sqf | 3 +-- .../functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf | 4 ++-- SQF/dayz_code/configVariables.sqf | 1 + 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf index bf3309cfb..9afae7487 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf @@ -41,7 +41,7 @@ _HasKeyCheck = { }; } count _inventory; }; - true; //change to _keyFound; to require key to sell vehicle + _keyFound; }; _totalPrice = 0; if(_total > 0)then{ @@ -83,7 +83,7 @@ if(_total > 0)then{ }; _HasKey = true; if (_vehTrade && {(typeOf Z_vehicle) == _y}) then { - if (!(_type in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"])) then { + if (!(_type in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"]) && DZE_SaleRequiresKey) then { _HasKey = [Z_vehicle, _all] call _HasKeyCheck; }; }; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf index 1f67098fc..7213f5b6f 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf @@ -20,7 +20,7 @@ _deleteTradedVehicle = { _VehKey2 = (_this select 0) select 0; _delType = _this select 1; if ((count _VehKey2) > 0) then { - if ((_VehKey2 select 0) == "0" || _delType in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"]) then { + if ((_VehKey2 select 0) == "0" || _delType in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"] || !DZE_SaleRequiresKey) then { _localResult2 = 1; } else { { @@ -31,7 +31,6 @@ _deleteTradedVehicle = { }; } forEach (items player); }; - _localResult2 = 1; //comment out to require key to sell vehicles if (isNil "_localResult2") then { _localResult2 = 0; } else { diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf index fe0ad5b82..efae1cf81 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf @@ -13,7 +13,7 @@ _weaps = _this select 2; _bags = []; _vehInfo = []; _keyID = 0; -_deleteVeh = true; //set to false to require key to sell vehicles +_deleteVeh = false; if(count _this > 3) then { if (count (_this select 3) > 0) then { @@ -117,7 +117,7 @@ if (count _vehInfo > 0) then { }; }; } count _normalWeaps; - if (_keyID == "0") then {_deleteVeh = True;}; + if (_keyID == "0" || !DZE_SaleRequiresKey) then {_deleteVeh = True;}; } else { _deleteVeh = True; }; diff --git a/SQF/dayz_code/configVariables.sqf b/SQF/dayz_code/configVariables.sqf index a6ae8536f..7dcc65768 100644 --- a/SQF/dayz_code/configVariables.sqf +++ b/SQF/dayz_code/configVariables.sqf @@ -50,6 +50,7 @@ DZE_GodModeBaseExclude = []; //Array of object class names excluded from the god DZE_advancedTrading = true; //Use advanced trading system. WARNING: set to false if you use database traders, you should use config-traders anyway! DZE_serverLogTrades = true; // Log trades to server RPT (sent with publicVariableServer on every trade) DZE_GemWorthArray = [["ItemTopaz",15000], ["ItemObsidian",20000], ["ItemSapphire",25000], ["ItemAmethyst",30000], ["ItemEmerald",35000], ["ItemCitrine",40000], ["ItemRuby",45000]]; //array of gem prices, works only in advanced trading +DZE_SaleRequiresKey = false; //Require the player has the key for a vehicle in oreder to sell it. The key can be in the player's toolbelt or backpack, or the vehicle's inventory. False by default Z_AT_FolderLocation = '\z\addons\dayz_code\actions\AdvancedTrading'; Z_VehicleDistance = 40; // Distance that a vehicle needs to be to see it's content or to sell it. Z_SingleCurrency = false; // Does your server use a single currency system.