From 50c6b485243515bbe31a04849a0be01461c5df22 Mon Sep 17 00:00:00 2001 From: "ctc.Sebi" Date: Tue, 15 Oct 2013 22:14:23 +0200 Subject: [PATCH] Check for _needNear produces errors because "X" in _array can't be used on a string. My previous fix included a broken default part.. now it's working as inteded without any extra stuff. --- SQF/dayz_code/actions/player_build.sqf | 42 ++++++++++++++------------ 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/SQF/dayz_code/actions/player_build.sqf b/SQF/dayz_code/actions/player_build.sqf index 98f27d649..acf1a3654 100644 --- a/SQF/dayz_code/actions/player_build.sqf +++ b/SQF/dayz_code/actions/player_build.sqf @@ -50,26 +50,30 @@ _needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> { _need = _x select 0; _distance = _x select 1; - - if("fire" in _need) then { - _isNear = {inflamed _x} count (position player nearObjects _distance); - if(_isNear == 0) then { - _abort = true; - _reason = "fire"; + switch(_need) do{ + case "fire": + { + _isNear = {inflamed _x} count (position player nearObjects _distance); + if(_isNear == 0) then { + _abort = true; + _reason = "fire"; + }; }; - }; - if("workshop" in _need) then { - _isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]); - if(_isNear == 0) then { - _abort = true; - _reason = "workshop"; + case "workshop": + { + _isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]); + if(_isNear == 0) then { + _abort = true; + _reason = "workshop"; + }; }; - }; - if("fueltank" in _need) then { - _isNear = count (nearestObjects [player, dayz_fuelsources, _distance]); - if(_isNear == 0) then { - _abort = true; - _reason = "fuel tank"; + case "fueltank": + { + _isNear = count (nearestObjects [player, dayz_fuelsources, _distance]); + if(_isNear == 0) then { + _abort = true; + _reason = "fuel tank"; + }; }; }; } forEach _needNear; @@ -536,4 +540,4 @@ if (_hasrequireditem) then { }; }; -TradeInprogress = false; \ No newline at end of file +TradeInprogress = false;