From 76314d5636b2f65596e9a5f588614050007b9082 Mon Sep 17 00:00:00 2001 From: Florian Kinder Date: Wed, 12 Feb 2014 15:38:51 +0100 Subject: [PATCH] Fixed if _hiveResponse is null 13:21:08 "HIVE: trying to get objects" 13:21:08 Error in expression 13:21:08 Error position: <_resultArray }; server_hiveReadWriteLar> 13:21:08 Error Undefined variable in expression: _resultarray 13:21:08 File z\addons\dayz_server\init\server_functions.sqf, line 172 13:21:08 Error in expression 13:21:08 Error position: <_hiveResponse)); _hiveResponse = ["",0];> 13:21:08 Error Undefined variable in expression: _hiveresponse 13:21:08 File z\addons\dayz_server\system\server_monitor.sqf, line 38 --- SQF/dayz_server/system/server_monitor.sqf | 72 ++++++++++++----------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/SQF/dayz_server/system/server_monitor.sqf b/SQF/dayz_server/system/server_monitor.sqf index d705eaa71..f69414ed0 100644 --- a/SQF/dayz_server/system/server_monitor.sqf +++ b/SQF/dayz_server/system/server_monitor.sqf @@ -8,7 +8,7 @@ waitUntil{initialized}; //means all the functions are now defined diag_log "HIVE: Starting"; waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player) - + // Custom Configs if(isnil "MaxVehicleLimit") then { MaxVehicleLimit = 50; @@ -33,20 +33,26 @@ if (isServer and isNil "sm_done") then { for "_i" from 1 to 5 do { diag_log "HIVE: trying to get objects"; _key = format["CHILD:302:%1:", dayZ_instance]; - _hiveResponse = _key call server_hiveReadWrite; - if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then { - diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse)); + _hiveResponse = _key call server_hiveReadWrite; + if (isnil "_hiveResponse") then { + diag_log ("HIVE: connection problem... unable to call HiveExt"); _hiveResponse = ["",0]; - } + } else { - diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" ); - _i = 99; // break + if ({(typeName _hiveResponse != "ARRAY")} || {((typeName (_hiveResponse select 1)) != "SCALAR")}) then { + diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse)); + _hiveResponse = ["",0]; + } + else { + diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" ); + _i = 99; // break + }; }; }; - + _BuildingQueue = []; _objectQueue = []; - + if ((_hiveResponse select 0) == "ObjectStreamStart") then { diag_log ("HIVE: Commence Object Streaming..."); _key = format["CHILD:302:%1:", dayZ_instance]; @@ -66,7 +72,7 @@ if (isServer and isNil "sm_done") then { }; diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles"); }; - + // # NOW SPAWN OBJECTS # _totalvehicles = 0; { @@ -79,7 +85,7 @@ if (isServer and isNil "sm_done") then { _hitPoints = _x select 6; _fuel = _x select 7; _damage = _x select 8; - + _dir = 0; _pos = [0,0,0]; _wsDone = false; @@ -90,19 +96,19 @@ if (isServer and isNil "sm_done") then { _pos = _worldspace select 1; _wsDone = true; } - }; - + }; + if (!_wsDone) then { if (count _worldspace >= 1) then { _dir = _worldspace select 0; }; _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos; if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; }; diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos)); }; - + if (_damage < 1) then { //diag_log format["OBJ: %1 - %2", _idKey,_type]; - + //Create it _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"]; _object setVariable ["lastUpdate",time]; @@ -138,15 +144,15 @@ if (isServer and isNil "sm_done") then { }; _object setVariable ["CharacterID", _ownerID, true]; - + clearWeaponCargoGlobal _object; clearMagazineCargoGlobal _object; // _object setVehicleAmmo DZE_vehicleAmmo; - + _object setdir _dir; _object setposATL _pos; _object setDamage _damage; - + if ((typeOf _object) in dayz_allowedObjects) then { if (DZE_GodModeBase) then { _object addEventHandler ["HandleDamage", {false}]; @@ -157,7 +163,7 @@ if (isServer and isNil "sm_done") then { _object enableSimulation false; // used for inplace upgrades and lock/unlock of safe _object setVariable ["OEMPos", _pos, true]; - + }; if (count _intentory > 0) then { @@ -171,7 +177,7 @@ if (isServer and isNil "sm_done") then { //Add weapons _objWpnTypes = (_intentory select 0) select 0; _objWpnQty = (_intentory select 0) select 1; - _countr = 0; + _countr = 0; { if(_x in (DZE_REPLACE_WEAPONS select 0)) then { _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x); @@ -181,8 +187,8 @@ if (isServer and isNil "sm_done") then { _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)]; }; _countr = _countr + 1; - } forEach _objWpnTypes; - + } forEach _objWpnTypes; + //Add Magazines _objWpnTypes = (_intentory select 1) select 0; _objWpnQty = (_intentory select 1) select 1; @@ -209,8 +215,8 @@ if (isServer and isNil "sm_done") then { _countr = _countr + 1; } forEach _objWpnTypes; }; - }; - + }; + if (_object isKindOf "AllVehicles") then { { _selection = _x select 0; @@ -222,14 +228,14 @@ if (isServer and isNil "sm_done") then { _object setFuel _fuel; if (!((typeOf _object) in dayz_allowedObjects)) then { - + //_object setvelocity [0,0,1]; - _object call fnc_veh_ResetEH; - + _object call fnc_veh_ResetEH; + if(_ownerID != "0" and !(_object isKindOf "Bicycle")) then { _object setvehiclelock "locked"; }; - + _totalvehicles = _totalvehicles + 1; // total each vehicle @@ -242,7 +248,7 @@ if (isServer and isNil "sm_done") then { }; } forEach (_BuildingQueue + _objectQueue); // # END SPAWN OBJECTS # - + // preload server traders menu data into cache if !(DZE_ConfigTrader) then { @@ -259,11 +265,11 @@ if (isServer and isNil "sm_done") then { _data = "HiveEXT" callExtension _key; //diag_log "HIVE: Request sent"; - + //Process result _result = call compile format ["%1",_data]; _status = _result select 0; - + if (_status == "ObjectStreamStart") then { _val = _result select 1; //Stream Objects @@ -348,7 +354,7 @@ if (isServer and isNil "sm_done") then { if(isnil "spawnMarkerCount") then { spawnMarkerCount = 10; }; - + actualSpawnMarkerCount = 0; // count valid spawn marker positions @@ -359,7 +365,7 @@ if (isServer and isNil "sm_done") then { // exit since we did not find any further markers _i = spawnMarkerCount + 99; }; - + }; diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount]; };