ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. setVehicleRespawnPosition

Function

setVehicleRespawnPosition

ServerVehiclesIdentical to MTA:SA

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 rx changes 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