Scripting/Squirrel/Functions/Vehicles/RespawnAt
From VC-MP Wiki
This function respawns the vehicle and sets its position to the given coordinates. The position will be reset to the original spawn position on next respawn. 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.RespawnAt( Vector vPos, float angle )
Arguments
- vPos - This is the position the vehicle after respawning it
- angle - This will be the z-angle of the vehicle after respawning
Example
This command will change the respawn position of the vehicle to the current player position with '/c spawnat <car id>'.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "spawnat" ) { local vehicle = FindVehicle( text.tointeger() ); vehicle.RespawnAt( player.Pos, player.Angle ); } }
Notes
The call onPlayerCommand and functions Player.Pos, Player.Angle, FindVehicle were also used in this example. More info about this in the corresponding page.
Related Functions
- CreateVehicle
- FindVehicle
- GetVehicleCount
- GetVehicleModelFromName
- GetVehicleNameFromModel
- Vehicle.Alarm
- Vehicle.Angle
- Vehicle.Colour1
- Vehicle.Colour2
- Vehicle.Driver
- Vehicle.Fix
- Vehicle.Health
- Vehicle.ID
- Vehicle.IsLocked
- Vehicle.KillEngine
- Vehicle.Lights
- Vehicle.Model
- Vehicle.Pos
- Vehicle.Respawn
- Vehicle.RespawnAs
- Vehicle.RespawnAt
- Vehicle.SetFlatTyres
- Vehicle.SpawnPos
- Vehicle.SpawnAngle
- Vehicle.Velocity
- Vehicle.Remove
