Need help with server_cleanup.fsm (Ammo-Crates)

SchwEde

OpenDayZ Rockstar!
Hey Guys,

i hope one of you guys can help me with my issue.

I'm using normal DayZ .1.8.0.3 and try to get Mission System and Ammo-Crates working.
I will try to descripe my Problem as good as i can.

As far as i know the problem is my server_cleanup.fsm
Following Scripts need also to change the line in the cleanup.fsm:
Sarge-AI
Admin-Tools
Mission-System

In every Tutorial of each Script is a bit other line.
This is my Clean Server_cleanup.fsm:
Code:
      "//Check for hackers" \n
      " {" \n
      "      if(vehicle _x != _x && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
      "        diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
      "          (vehicle _x) setDamage 1;" \n
      "          _x setDamage 1;" \n
      "    };" \n
      " } forEach allUnits;" \n
      "" \n
      "dayz_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;

I tried different version:
Code:
if(vehicle _x != _x && (vehicle _x getVariable [""Sarge"",0] != 1) && (vehicle _x getVariable [""Mission"",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
With this line the crates disappear after a while. I also tried it with only (vehicle _x getVariable [""Sarge"",0] != 1) and only (vehicle _x getVariable [""Missoin"",0] != 1) in this line, but no luck.

Also it didnt help to comment out the whole section.

The only line which work is:
Code:
if(vehicle _x != _x && (vehicle _x getVariable ["Sarge",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) !=

The only Problem with this one is. The Vehicle Damage wont get updated :(

I hope one of you guys can give me some help with this one.

Thank you very much and Cheers
 
Your line should look like:
Code:
"      if(vehicle _x != _x && !(vehicle _x in _safety) && (vehicle _x getVariable ["Sarge",0] != 1) && (vehicle _x getVariable ["Mission",0] != 1) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n

However, that would just prevent your AI and Mission vehicles from blowing up and killing whoever is inside them (hence Killing a Hacker).

Your problem is in server.pbo > compile > server_updateObject.sqf (or similar named)

You need to add two lines.
Under:
Code:
if ((typeName _objectID != "string") || (typeName _uid != "string")) then
{
    diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]);
    //force fail
    _objectID = "0";
    _uid = "0";
};

Put:
Code:
if (_object getVariable "Sarge" == 1) exitWith {};
if (_object getVariable "Mission" == 1) exitWith {};

If your file looks different I'll have to see it.
 
I'm using DZAI now.

here is my server_updateObject.sqf:
Code:
/*
[_object,_type] spawn server_updateObject;
*/
private ["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk"];
 
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
 
_object =    _this select 0;
_type =    _this select 1;
_forced = false;
if (count _this > 2) then {
    _forced = _this select 2;
};
_parachuteWest = typeOf _object == "ParachuteWest";
_isNotOk = false;
 
_objectID = "0";
_uid = "0";
 
if (!((isNil "_object") OR {(isNull _object)})) then {
    _objectID = _object getVariable ["ObjectID","0"];
    _uid = _object getVariable ["ObjectUID","0"];
};
 
if ((typeName _objectID != "string") || (typeName _uid != "string")) then
{
#ifdef OBJECT_DEBUG
    diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]);
#endif
    //force fail
    _objectID = "0";
    _uid = "0";
};
 
if (_object getVariable "Mission" == 1) exitWith {};
 
if (!_parachuteWest) then {
    if ((typeOf _object) in SafeObjects) then {
 
    } else {
        if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then
        {
            _object_position = getPosATL _object;
            #ifdef OBJECT_DEBUG
                diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",
                typeOf _object,
                _object_position select 0,
                _object_position select 1,
                _object_position select 2]);
            #endif
                _isNotOk = true;
        };
    };
};
 
if (_isNotOk) exitWith { deleteVehicle _object; };
 
_lastUpdate = _object getVariable ["lastUpdate",diag_tickTime];
_needUpdate = _object in needUpdate_objects;
 
// TODO ----------------------
_object_position = {
    private["_position","_worldspace","_fuel","_key"];
    _position = getPosATL _object;
    _worldspace = [
        round(direction _object),
        _position
    ];
    _fuel = 0;
    if (_object isKindOf "AllVehicles") then {
        _fuel = fuel _object;
    };
    _key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
    #ifdef OBJECT_DEBUG
    diag_log ("HIVE: WRITE: "+ str(_key));
    #endif
 
    _key call server_hiveWrite;
};
 
// ###COPY START
_object_inventory = {
// ### BASE BUILDING 1.2 ### START
//This forces object to write to database changing the inventory of the object twice
// so it updates the object from operate_gates.sqf
 
    private["_inventory","_previous","_key"];
    // This writes to database if object is buildable
    if (typeOf(_object) in allbuildables_class) then {
    //First lets make inventory [[[],[]],[[],[]],[[],[]]] so it updates object in DB
            _inventory = [[[],[]],[[],[]],[[],[]]];
        if (_objectID == "0") then {
            _key = format["CHILD:309:%1:%2:",_uid,_inventory];
        } else {
            _key = format["CHILD:303:%1:%2:",_objectID,_inventory];
        };
        diag_log ("HIVE: Buildable: "+ str(_key));
        _key call server_hiveWrite;
    //Since we cant actually read from DB, lets make inventory this [], than write it again, to insure its updated to DB
            _inventory = [];
        if (_objectID == "0") then {
            _key = format["CHILD:309:%1:%2:",_uid,_inventory];
        } else {
            _key = format["CHILD:303:%1:%2:",_objectID,_inventory];
        };
        diag_log ("HIVE: Buildable: "+ str(_key));
        _key call server_hiveWrite;
// DO DEFAULT server_updateObject if not a buildable
    } else {
            _inventory = [
            getWeaponCargo _object,
            getMagazineCargo _object,
            getBackpackCargo _object
        ];
 
 
        _previous = str(_object getVariable["lastInventory",[]]);
        if (str(_inventory) != _previous) then {
            _object setVariable["lastInventory",_inventory];
            if (_objectID == "0") then {
                _key = format["CHILD:309:%1:%2:",_uid,_inventory];
            } else {
                _key = format["CHILD:303:%1:%2:",_objectID,_inventory];
            };
            diag_log ("HIVE: WRITE: "+ str(_key));
            _key call server_hiveWrite;
        };
    };
};
// ### BASE BUILDING 1.2 ### END
// ###COPY END
 
_object_damage = {
    //Allow dmg process
    private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    _hitpoints = _object call vehicle_getHitpoints;
    _damage = damage _object;
    _array = [];
    {
        _hit = [_object,_x] call object_getHit;
        _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
        if (_hit > 0) then {
            _array set [count _array,[_selection,_hit]];
            //diag_log format ["Section Part: %1, Dmg: %2",_selection,_hit];
        } else {
            _array set [count _array,[_selection,0]];
        };
 
 
 
    } forEach _hitpoints;
 
    if (_forced) then { 
        if (_object in needUpdate_objects) then {
            needUpdate_objects = needUpdate_objects - [_object];
        };
     
        if (_objectID == "0") then {
            _key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage];
        } else {
            _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
        };
        diag_log ("HIVE: WRITE: "+ str(_key));
        _key call server_hiveWrite; 
 
    } else {     
        if (!(_object in needUpdate_objects)) then {
            //#ifdef OBJECT_DEBUG
                diag_log format["DEBUG: Monitoring: %1",_object];
            //#endif
            needUpdate_objects set [count needUpdate_objects, _object];
        };
    };
};
 
_object_killed = {
    _object setDamage 1;
    call _object_damage;
};
 
_object setVariable ["lastUpdate",time,true];
switch (_type) do {
    case "all": {
        call _object_position;
        call _object_inventory;
        call _object_damage;
    };
    case "position": {
        call _object_position;
    };
    case "gear": {
        call _object_inventory;
    };
    case "damage"; case "repair" : {
        call _object_damage;
    };
    case "killed": {
        call _object_killed;
    };
};

Maybe you see something :)

EDIT: Just tested it with following lines:
Code:
if (!_parachuteWest) then {
    if ((typeOf _object) in SafeObjects) then {
 
    } else {
        if (_objectID == "0" && _uid == "0") then
        {
            _object_position = getPosATL _object;
            #ifdef OBJECT_DEBUG
                diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",
                typeOf _object,
                _object_position select 0,
                _object_position select 1,
                _object_position select 2]);
            #endif
                _isNotOk = true;
        };
    };
};

They still disappear, but at least there is no Error anymore like:
Code:
Server: Object 5:91 not found (message 70)
 
i dont know which sqf you mean exactly, but for now i think i've got them working.

I edit server_updateObject to this:
Code:
if (!_parachuteWest) then {
  if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then
  {
      _object_position = getPosATL _object;
      #ifdef OBJECT_DEBUG
          diag_log format ["DEBUG: Deleting object %1 with invalid ID at [%2,%3,%4]“, typeOf _object, _object_position select 0, _object_position select 1,
        typeOf _object,
        _object_position select 0,
        _object_position select 1,
        _object_position select 2]);
      #endif
        _isNotOk = true;
  };
};

The only problem i've got for now is that my vehicle damage wont get updated:
this shows up in my RPT, after i blow up a SUV:
Code:
15:05:05 "OBJ: 1 - SUV_DZ,0,[194,[9618.97,11950,-0.0003815]],[[[],[]],[["PipeBomb"],[1]],[[],[]]],[["wheel_1_1_steering",0.912],["wheel_1_2_steering",1],["wheel_2_1_steering",0.501],["wheel_2_2_steering",1],["palivo",0.8],["motor",0.284],["glass1",0.513],["glass2",0.211],["glass3",0.136],["glass4",0.023]],0.982,0"
15:05:05 class HitPoints::HitRGlass not found in SUV_DZ
15:05:05 class HitPoints::HitLGlass not found in SUV_DZ
15:05:05 class HitPoints::HitBody not found in SUV_DZ
15:05:05 class HitPoints::HitLF2Wheel not found in SUV_DZ
15:05:05 class HitPoints::HitRF2Wheel not found in SUV_DZ
15:05:05 class HitPoints::HitLMWheel not found in SUV_DZ
15:05:05 class HitPoints::HitRMWheel not found in SUV_DZ
15:05:06 Error in expression <compile format ["%1", _data];
 
Yeah I would use the default and use the line I posted.

I mean a mission file as in
Server.PBO > Missions > Major/Minor > SM1.sqf

I'm assuming the issue is that the variable its attaching to your crates is different than the one your trying to prevent from getting cleaned up in updateObject.sqf.

I need to see though to tell.
 
maybe this gives you a bit more information:
Code:
15:46:05 "OBJ: 1 - SUV_DZ,0,[194,[9618.97,11950,-0.0003815]],[[[],[]],[["PipeBomb"],[1]],[[],[]]],[["wheel_1_1_steering",0.912],["wheel_1_2_steering",1],["wheel_2_1_steering",0.501],["wheel_2_2_steering",1],["palivo",0.8],["motor",0.284],["glass1",0.513],["glass2",0.211],["glass3",0.136],["glass4",0.023]],0.982,0"
15:46:05 class HitPoints::HitRGlass not found in SUV_DZ
15:46:05 class HitPoints::HitLGlass not found in SUV_DZ
15:46:05 class HitPoints::HitBody not found in SUV_DZ
15:46:05 class HitPoints::HitLF2Wheel not found in SUV_DZ
15:46:05 class HitPoints::HitRF2Wheel not found in SUV_DZ
15:46:05 class HitPoints::HitLMWheel not found in SUV_DZ
15:46:05 class HitPoints::HitRMWheel not found in SUV_DZ
15:46:06 Error in expression <compile format ["%1", _data];
_status = _result select 0;
 
msgList = [];
_msgCou>
15:46:06  Error position: <_result select 0;
 
msgList = [];
_msgCou>
15:46:06  Error Undefined variable in expression: _result
15:46:06 File z\addons\dayz_server\system\server_monitor.sqf, line 58
 
That error is because of the change you made. It is trying to get the coordinates of the object that is being deleted and errors for some reason.
 
I've changed it now to and vehicle damage gets updated:
Code:
if (!_parachuteWest) then {
  if (_objectID == "0" && _uid == "0" && (vehicle _object getVariable ["Sarge",0] != 1)) then
  {
      _object_position = getPosATL _object;
        #ifdef OBJECT_DEBUG
                diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",
                typeOf _object,
                _object_position select 0,
                _object_position select 1,
                _object_position select 2]);
            #endif
        _isNotOk = true;
  };
};

thought I've got it but they still disappear -.-
 
I'm having this issue now. I'm using DZAI. Could someone who has got this to work with 1.0.3 and has DZAI in as well post a copy of their updateobject and cleanup files?
 
Back
Top