- Documentation
- Shared functions
- isVehicleBlown
Function
isVehicleBlown
Checks whether a vehicle is a wreck, i.e. it was destroyed (blowVehicle or an explosion in the game) and has not been repaired or respawned yet. A wreck cannot be driven.
Syntax
bool isVehicleBlown(vehicle vehicle)Arguments
vehiclevehicle- The vehicle to check.
Returns
true for a wreck, otherwise false.
Example
addCommandHandler("wraki", function(player)
local count = 0
for _, vehicle in ipairs(getElementsByType("vehicle")) do
if isVehicleBlown(vehicle) then count = count + 1 end
end
outputChatBox("Wrakow na mapie: " .. count, player)
end)
See also
blowVehicleDestroys a vehicle: health drops to 0, the engine stops, the vehicle becomes a wreck (isVehicleBlown=true) and theonVehicleExplodeevent 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 withsetVehicleRespawnDelay(10 s by default); without respawning the wreck disappears after the time fromsetVehicleWreckDelay(20 s by default). Blowing up an already destroyed vehicle does nothing.fixVehicleRepairs a vehicle to factory condition: 1000 health, and every door, body panel, lamp and wheel returns to undamaged; a wreck stops being a wreck. It also cancels a scheduled wreck respawn. For one second after the repair the server ignores damage reports from the game so the old damage does not come back. Colour, tuning and plate stay as they were.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.