- Documentation
- Server functions
- setVehicleRespawnPosition
Function
setVehicleRespawnPosition
Sets the place (and optionally the rotation) where the vehicle appears when it respawns: after destruction, after being abandoned and on respawnVehicle. By default it is where the vehicle was created. The vehicle is not moved right away.
Syntax
bool setVehicleRespawnPosition(vehicle vehicle, float x, float y, float z [, float rx = bez zmian, float ry = 0, float rz = 0])Arguments
vehiclevehicle- The vehicle.
xfloat- X coordinate.
yfloat- Y coordinate.
zfloat- Z height.
rxfloat, optional = bez zmian- X rotation in degrees. Passing
rxchanges the whole respawn rotation. ryfloat, optional = 0- Y rotation in degrees.
rzfloat, optional = 0- Heading in degrees.
Returns
true on success.
Example
addCommandHandler("parkuj", function(player)
local vehicle = getPedOccupiedVehicle(player)
if not vehicle then return end
local x, y, z = getElementPosition(vehicle)
local rx, ry, rz = getElementRotation(vehicle)
setVehicleRespawnPosition(vehicle, x, y, z, rx, ry, rz)
outputChatBox("Tu bedzie wracac to auto.", player)
end)
See also
getVehicleRespawnPositionReturns the coordinates of the place where the vehicle appears when it respawns.setVehicleRespawnRotationSets the rotation the vehicle will have when it respawns (the respawn position stays the same).respawnVehicleImmediately respawns a vehicle at its respawn point (where it was created, or the point fromsetVehicleRespawnPosition). All occupants are removed from the vehicle, its speed is zeroed, health goes back to 1000 and door, panel, lamp and wheel damage disappears. Fires theonVehicleRespawnevent. Also works for a vehicle that is not a wreck.