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

Function

blowVehicle

ServerVehiclesIdentical to MTA:SA

Destroys a vehicle: health drops to 0, the engine stops, the vehicle becomes a wreck (isVehicleBlown = true) and the onVehicleExplode event fires. By default every player also sees an explosion. If respawning is enabled for the vehicle (toggleVehicleRespawn, off by default), the wreck returns to its spawn point after the time set with setVehicleRespawnDelay (10 s by default); without respawning the wreck disappears after the time from setVehicleWreckDelay (20 s by default). Blowing up an already destroyed vehicle does nothing.

Syntax

bool blowVehicle(vehicle vehicle [, bool explode = true])

Arguments

vehiclevehicle
The vehicle to destroy.
explodebool, optional = true
true = with a visible explosion; false = the vehicle quietly becomes a wreck with no explosion.

Returns

true on success, false when the vehicle is already a wreck.

Example

addCommandHandler("wysadz", function(player)
    local vehicle = getPedOccupiedVehicle(player)
    if vehicle then blowVehicle(vehicle) end
end)

See also