SA-MP Forums Archive
How do I make a vehicle respawn when not in it - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How do I make a vehicle respawn when not in it (/showthread.php?tid=462775)



How do I make a vehicle respawn when not in it - ExtendedCarbon - 08.09.2013

I've tried to do it on OnPlayerExitVehicle(playerid, vehicleid)

But I also have teleport commands too, and when i use the teleport command it doesn't respawn the vehicle

My respawn thing
Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	SetTimerEx("OnPlayerVehicleRespawn", 3000, false, "i", vehicleid);
	return 1;
}

forward OnPlayerVehicleRespawn(vehicleid);
public OnPlayerVehicleRespawn(vehicleid)
{
    SetVehicleToRespawn(vehicleid);
}
My Teleport command
Код:
        COMMAND:lva(playerid, params[])
	{
	    SetPlayerVirtualWorld(playerid, 0);
	    SendClientMessage(playerid, COLOR_YELLOW, "You have teleported to: Las Venturas Airport");
	    SetPlayerPos(playerid, 1363.5719,1657.6664,10.8203);
	    return 1;
	}



Re: How do I make a vehicle respawn when not in it - Konstantinos - 08.09.2013

It removes the player, the player does not press enter/f to exit the vehicle so it will be called.

So:

Quote:
Originally Posted by doreto
Посмотреть сообщение
CreateVehicle(modelid, Float: x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay - The delay until the car is respawned without a driver in seconds);
or
AddStaticVehicleEx(modelid, Float: x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay - The delay until the car is respawned without a driver in seconds);

When player exit from behicle after x seconds vehicle will be respawned.
Or

Use OnPlayerStateChange instead. If the oldstate was driver and the newstate is different from driver (to prevent /getin command - if you have) and do the rest.