Jump to content
node

Save Vehicle After Restart

Recommended Posts

I am on an Altis Life mission file, is it possible to make it to were after a server restart if any players vehicles are not saved into a garage it will automatically save them?

Here is the script for storing your vehicle(s)

private["_nearVehicles","_vehicle"];
if(vehicle player != player) then
{
_vehicle = vehicle player;
}
else
{
_nearVehicles = nearestObjects[getPos (_this select 0),["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
if(count _nearVehicles > 0) then
{
	{
		if(!isNil "_vehicle") exitWith {}; //Kill the loop.
		_vehData = _x getVariable["vehicle_info_owners",[]];
		if(count _vehData  > 0) then
		{
			_vehOwner = (_vehData select 0) select 0;
			if((getPlayerUID player) == _vehOwner) exitWith
			{
				_vehicle = _x;
			};
		};
	} foreach _nearVehicles;
};
};

if(isNil "_vehicle") exitWith {hint localize "STR_Garage_NoNPC"};
if(isNull _vehicle) exitWith {};
[[_vehicle,false,(_this select 1)],"TON_fnc_vehicleStore",false,false] spawn life_fnc_MP;
hint localize "STR_Garage_Store_Server";
life_garage_store = true;

Share this post


Link to post
Share on other sites

Ok I have looked at the BIKI for it but how would I get it to save vehicles after restart? The biki doesn't really give a good description on how to use it.

Share this post


Link to post
Share on other sites

so like this

profileNamespace setVariable ["life_garage_store",[]];
_vehicle = profileNamespace getVariable "life_garage_store";

if(isNil "_vehicle") exitWith {hint localize "STR_Garage_NoNPC"};
if(isNull _vehicle) exitWith {};
[[_vehicle,false,(_this select 1)],"TON_fnc_vehicleStore",false,false] spawn life_fnc_MP;
hint localize "STR_Garage_Store_Server";
life_garage_store = true;

Edited by Node

Share this post


Link to post
Share on other sites

Hi, long story short, I own a lakeside server and have no idea how to script, how should I add script that saves the vehicles in garage after restart?

Share this post


Link to post
Share on other sites
On 2015-04-13 at 1:49 AM, node said:

I am on an Altis Life mission file, is it possible to make it to were after a server restart if any players vehicles are not saved into a garage it will automatically save them?

Here is the script for storing your vehicle(s)

 


private["_nearVehicles","_vehicle"];
if(vehicle player != player) then
{
_vehicle = vehicle player;
}
else
{
_nearVehicles = nearestObjects[getPos (_this select 0),["Car","Air","Ship"],30]; //Fetch vehicles within 30m.
if(count _nearVehicles > 0) then
{
	{
		if(!isNil "_vehicle") exitWith {}; //Kill the loop.
		_vehData = _x getVariable["vehicle_info_owners",[]];
		if(count _vehData  > 0) then
		{
			_vehOwner = (_vehData select 0) select 0;
			if((getPlayerUID player) == _vehOwner) exitWith
			{
				_vehicle = _x;
			};
		};
	} foreach _nearVehicles;
};
};

if(isNil "_vehicle") exitWith {hint localize "STR_Garage_NoNPC"};
if(isNull _vehicle) exitWith {};
[[_vehicle,false,(_this select 1)],"TON_fnc_vehicleStore",false,false] spawn life_fnc_MP;
hint localize "STR_Garage_Store_Server";
life_garage_store = true;
 

 

 

 

I have the same problem, after server restart, vehicles that are not stored in garage, just disappears. 

I use Altis life v5. 

Your provide script not working for me.

Could you help me ion this please?

Share this post


Link to post
Share on other sites

Just remember that profileNamespace pertains to the profile and not just the user, so if the user switches profiles > data isnt going to be found

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×