Jump to content

Repair / Refuel - Database doesnt save


Aidem

Recommended Posts

Would this work if i add this 

call server_updateObject;

after you get the Refuel and repair has end in the Repair.sqf?

private ["_target", "_caller", "_id"];
 
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_args = _this select 3;
_amount = _args select 0;
_amount2 = _args select 1;
 
if (isNil "ib_refueling_in_progress") then { ib_refueling_in_progress = false; };
 
if (!ib_refueling_in_progress) then {
 
        ib_refueling_in_progress = true;
 
        titleText ["Refueling and Repairing", "PLAIN DOWN", 3];
 
        while {(vehicle _caller == _target) and (local _target)} do {
                private ["_velocity", "_cfcust","_cfcust2"];
   
                _velocity = velocity _target;
                _cfcust = fuel _target;
				_cfcust2 = damage _target;
 
                if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith {
                        titleText ["Refueling and Repairs Stopped", "PLAIN DOWN", 3];
                };
                if (_cfcust >= 1 and _cust2 <= 0) exitWith {
                        titleText ["Refueling and Repairs Completed", "PLAIN DOWN", 3];
                };
 
                sleep 0.5;
 
                _cfcust = _cfcust + _amount;

                if (_cfcust >= 1.0) then { _cfcust = 1.0; };
 
                _target setFuel _cfcust;
				
				_cfcust2 = _cfcust2 - _amount2;
				if (_cfcust2 <= 0.0) then { _cfcust2 = 0.0; };
				_target setDamage _cfcust2;
        };
 
        titleFadeOut 1;
 
        ib_refueling_in_progress = false;
};

But where do i place it :s and how?

Something like this?

                if ((_velocity select 0 > 1) or (_velocity select 1 > 1) or (_velocity select 2 > 1)) exitWith {
                        titleText ["Refueling and Repairs Stopped", "PLAIN DOWN", 3];
                        _target call server_updateObject;
                };
Link to comment
Share on other sites

Also figured out that this script sets the Damage Value in the database to 0.0

But it leaves the Hitpoint value to what it is, and thats why on server restart the hitpoints get called back from the database

 

Also is this a possible fix?

                _target setFuel _cfcust;
				
				_cfcust2 = _cfcust2 - _amount2;
				if (_cfcust2 <= 0.0) then { _cfcust2 = 0.0; };
				_target setDamage _cfcust2;
                                _target setHit [];
Link to comment
Share on other sites

  • 4 weeks later...

That does not work because the script only sets the damage to 0 and is not repairing the damaged parts itself so it won't get saved to the database because it's not really fixed (you can see that if you use the repair option after your have "repaird" the vehicle with that script).

 

I would suggest using my new script that solves all your issues, one reason I did it myself, check it out here: http://dayzepoch.com/forum/index.php?/topic/3935-release-vehicle-service-point-refuel-repair-rearm-script/

Link to comment
Share on other sites

  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...