Jump to content
  • 0

Log vehicle damage?


tkdmaster

Question

Hey there, I'm having issues with people blowing out all the tires on locked cars and trying to figure out who is actually doing it.

 

I came across an older thread regarding destruction logs, but it didn't cover more minor damage, like destroying tires.

 

 

Would anyone have any idea how to get it working for damage to vehicles instead of their complete destruction?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Not at all sure about this code, since I dont have a test server to try it out on yet...  but here is a try.

 

IN: dayz_server\compile\server_updateObject.sqf

 

Find this:

_object_damage = {
    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]]};
            _object setHit ["_selection", _hit]
        } forEach _hitpoints;
   
        _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
        //diag_log ("HIVE: WRITE: "+ str(_key));
        _key call server_hiveWrite;
    _object setVariable ["needUpdate",false,true];
    if ( _damage >= 1 ) then { _object spawn { sleep 15; deleteVehicle _this; }; };
   };

Change it to look like this:

_object_damage = {
	private["_hitpoints","_array","_hit","_selection","_key","_damage","_attacker"];
		_hitpoints = _object call vehicle_getHitpoints;
		_damage = damage _object;
		_attacker = player;
		_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]]};
			_object setHit ["_selection", _hit]
			diag_log format["A Vehicle got hit in %2 by %3 (%4) at vehicle position %5", _selection, _attacker,(getPlayerUID _attacker), (mapGridPosition (getPos _object))];
		} forEach _hitpoints;
	
		_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
		//diag_log ("HIVE: WRITE: "+ str(_key));
		_key call server_hiveWrite;
	_object setVariable ["needUpdate",false,true];
	};

Now - I dont know if it is correct, or in the right place...  and likely you will get spammed by all the vehicle damage that will take place on the server.

Hopefully someone will correct my code before you see it. :)

Link to comment
Share on other sites

  • 0
On 6/11/2014 at 11:18 PM, Glenn said:

Not at all sure about this code, since I dont have a test server to try it out on yet...  but here is a try.

 

IN: dayz_server\compile\server_updateObject.sqf

 

Find this:


_object_damage = {
    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]]};
            _object setHit ["_selection", _hit]
        } forEach _hitpoints;
   
        _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
        //diag_log ("HIVE: WRITE: "+ str(_key));
        _key call server_hiveWrite;
    _object setVariable ["needUpdate",false,true];
    if ( _damage >= 1 ) then { _object spawn { sleep 15; deleteVehicle _this; }; };
   };

Change it to look like this:


_object_damage = {
	private["_hitpoints","_array","_hit","_selection","_key","_damage","_attacker"];
		_hitpoints = _object call vehicle_getHitpoints;
		_damage = damage _object;
		_attacker = player;
		_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]]};
			_object setHit ["_selection", _hit]
			diag_log format["A Vehicle got hit in %2 by %3 (%4) at vehicle position %5", _selection, _attacker,(getPlayerUID _attacker), (mapGridPosition (getPos _object))];
		} forEach _hitpoints;
	
		_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
		//diag_log ("HIVE: WRITE: "+ str(_key));
		_key call server_hiveWrite;
	_object setVariable ["needUpdate",false,true];
	};

Now - I dont know if it is correct, or in the right place...  and likely you will get spammed by all the vehicle damage that will take place on the server.

Hopefully someone will correct my code before you see it. :)

Can anyone confirm if this code works?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...