- Documentation
- Server functions
- setVehicleWreckDelay
Function
setVehicleWreckDelay
Sets how many milliseconds after the explosion a vehicle wreck disappears from the map (the element is destroyed, with onElementDestroy called; players inside fall out). The default is 20000 ms (20 s); 0 = the wreck stays forever. Passing root changes the default for all vehicles without their own setting. Does not apply to vehicles with respawning enabled (toggleVehicleRespawn) — those come back repaired at their respawn point. fixVehicle before the time runs out stops the removal. A change for a wreck already waiting restarts the countdown.
Syntax
bool setVehicleWreckDelay(vehicle vehicle, int ms)Arguments
vehiclevehicle- A vehicle or
root. msint- Time in milliseconds, 0 = the wreck stays.
Returns
true on success.
Example
-- wraki znikaja po minucie, a auta frakcji zostaja
setVehicleWreckDelay(root, 60000)
local radiowoz = createVehicle(596, 1535, -1675, 13.4)
setVehicleWreckDelay(radiowoz, 0)
See also
getVehicleWreckDelayReturns how many milliseconds after the explosion this vehicle's wreck disappears (forroot: the default, initially 20000).toggleVehicleRespawnEnables or disables automatic respawning of a vehicle. Off by default: a scripted vehicle does not come back by itself. When enabled, a wreck returns repaired to the respawn point after the time fromsetVehicleRespawnDelay, and an abandoned vehicle after the time fromsetVehicleIdleRespawnDelay. Disabling it cancels a wreck respawn already waiting in the queue; a wreck without respawning disappears after the time fromsetVehicleWreckDelay(20 s by default).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.