Jump to content

Save vehicles to database, but only if a player accesses it


Recommended Posts

My understanding has been that that is already the case.

 

Every mission file has the call to DZMSSaveVeh after the one to DZMSWaitMissionComp and DZMSWaitMissionComp only returns to the <mission>.sqf  if the mission has been completed successfully:

//Wait until the player is within 30 meters and also meets the kill req
[_coords,"DZMSUnitsMajor"] call DZMSWaitMissionComp;

//Call DZMSSaveVeh to attempt to save the vehicles to the database
//If saving is off, the script will exit.
[_vehicle] ExecVM DZMSSaveVeh;
[_vehicle1] ExecVM DZMSSaveVeh;

//Let everyone know the mission is over
[nil,nil,rTitleText,"The Crash Site has been Secured by Survivors!", "PLAIN",6] call RE;
diag_log text format["[DZMS]: Major EM1 C130 Mission has Ended."];
deleteMarker "DZMSMajMarker";
deleteMarker "DZMSMajDot";

//Let the timer know the mission is over
DZMSMajDone = true;
Link to comment
Share on other sites

 

My understanding has been that that is already the case.

 

Every mission file has the call to DZMSSaveVeh after the one to DZMSWaitMissionComp and DZMSWaitMissionComp only returns to the <mission>.sqf  if the mission has been completed successfully

 

That allows vehicles to be saved no matter what. I'd like to make it so if a player doesn't access the vehicle, it will disappear on restart, but if they get into it, it'll be written to the database.

Link to comment
Share on other sites

Hi,

 

Make sure

    DZMSSaveVehicles = true;

in DZMSConfig.sqf.

 

Comment out the line:

    [_vehicle] ExecVM DZMSSaveVeh;
    
in the DZMS missions files (SM1.sqf etc).

 

In DZMSFunctions.sqf there is a function called DZMSSetupVehicle.

change this line:

	if (!(DZMSSaveVehicles)) then {
		_object addEventHandler ["GetIn",{
			_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
		}];
	};

to this:

	if (!(DZMSSaveVehicles)) then {
		_object addEventHandler ["GetIn",{
			_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
		}];
	} else {
		_object addEventHandler ["GetIn",{
			_nil = [_this select 0] ExecVM DZMSSaveVeh;
		}];
	};

This should work, although there is probably a better way to do it.

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...