How do I make a vehicle respawn when not in it
#1

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;
	}
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)