Scripting/Squirrel/Functions/Vehicles/Respawn

From VC-MP Wiki

Jump to: navigation, search

This function respawns the vehicle. Note that if the vehicle has players inside while respawning it that may cause a client crash for everyone else but the driver.

Syntax

bool vehicle.Respawn()

Arguments

  • none

Example

This command will respawn a car by using '/c respawn <car id>'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "respawn" )
     {
          local vehicle = FindVehicle( text.tointeger() );
          vehicle.Respawn();
     }
}

Notes

The call onPlayerCommand and function FindVehicle were also used in this example. More info about this in the corresponding page.

Related Functions

Personal tools
squirrel scripting