SA-MP Forums Archive
Is it possible? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is it possible? (/showthread.php?tid=234388)



Is it possible? - yoan103 - 03.03.2011

I created some vehicles with the CreateVehicle command and they respawn. That's good. Now, if a player leaves a vehicle, i want the vehicle to be deleted after 15 seconds. Is it possible


Re: Is it possible? - tuuker - 03.03.2011

ofc,
pawn Код:
CreateVehicle(458,2076.7231,1656.9888,10.6719,177.5046,0,0,(Time how long to respawn);
Example:
pawn Код:
CreateVehicle(458,2076.7231,1656.9888,10.6719,177.5046,0,0,-1); // -1 means that it wont respawn change it to set respawn time.
Or you mean that you wanna delete it complitly?


Re: Is it possible? - Mean - 03.03.2011

Yes, but it's impossible to set it to 15 secs. You can set a timer: 15 seconds after player exits vehicle, and if he isn't there after 15 sec, DestroyVehicle.


Re: Is it possible? - thiaZ_ - 03.03.2011

pawn Код:
public OnPlayerExitVehicle( playerid, vehicleid )
{
    SetTimerEx( "PlsDeleteVehicle", 15000, 0, "d", vehicleid );
    return true;
}

forward PlsDeleteVehicle( vehicleid );
public PlsDeleteVehicle( vehicleid )
{
    DestroyVehicle( vehicleid );
    return true;
}
That's just a basic example, use

https://sampwiki.blast.hk/wiki/OnPlayerExitVehicle

for more info.


Re: Is it possible? - yoan103 - 03.03.2011

That's just what i needed, Thanks!


Re: Is it possible? - iggy1 - 03.03.2011

pawn Код:
CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 15);//last param respawn time in seconds.
That will respawn after 15seconds (without a driver) no need for timers.

Just noticed you wanted it deleting sorry.