SetVehicleToRespawn

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:43, 11 August 2015
Bm0z (Talk | contribs)
(Fixed operator (<= to <))
← Previous diff
Current revision
Ikkentim (Talk | contribs)
(Use GetVehiclePoolSize instead of MAX_VEHICLES)
Line 17: Line 17:
<pawn> <pawn>
-for(new i = 1; i < MAX_VEHICLES; i++)+for(new i = GetVehiclePoolSize(); i > 0; i--)
{ {
SetVehicleToRespawn(i); SetVehicleToRespawn(i);

Current revision



Description:

Sets a vehicle back to the position at where it was created.


Parameters:
(vehicleid)
vehicleidThe ID of the vehicle to respawn


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute. The vehicle does not exist


Example Usage:

// Respawns the first vehicle.
SetVehicleToRespawn(1);

Or you can also make every vehicle in the whole script to respawn:

for(new i = GetVehiclePoolSize(); i > 0; i--)
{
	SetVehicleToRespawn(i);
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

In other languages