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

Function

respawnVehicle

ServerVehiclesIdentical to MTA:SA

Immediately respawns a vehicle at its respawn point (where it was created, or the point from setVehicleRespawnPosition). 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 the onVehicleRespawn event. Also works for a vehicle that is not a wreck.

Syntax

bool respawnVehicle(vehicle vehicle)

Arguments

vehiclevehicle
The vehicle to respawn.

Returns

true on success.

Example

addCommandHandler("odrodzwszystkie", function()
    for _, vehicle in ipairs(getElementsByType("vehicle")) do
        if not getVehicleController(vehicle) then respawnVehicle(vehicle) end
    end
end)

See also