- Documentation
- Server functions
- setVehicleIdleRespawnDelay
Function
setVehicleIdleRespawnDelay
Sets after how many milliseconds an abandoned vehicle returns to its respawn point by itself. "Abandoned" means nobody is inside and it stands more than 0.5 m from the respawn point. The counter resets when someone gets in. The default is 60000 ms; 0 turns returning of abandoned vehicles off. The countdown runs for vehicles whose respawning was configured with any function from this group (e.g. this one) or which have been a wreck; a freshly created, unconfigured vehicle does not return by itself.
Syntax
bool setVehicleIdleRespawnDelay(vehicle vehicle, int ms)Arguments
vehiclevehicle- The vehicle.
msint- Time in milliseconds, 0 = off.
Returns
true on success.
Example
for _, vehicle in ipairs(getElementsByType("vehicle", resourceRoot)) do
setVehicleIdleRespawnDelay(vehicle, 10 * 60000)
end
See also
getVehicleIdleRespawnDelayReturns after how many milliseconds an abandoned vehicle returns to its respawn point (60000 by default, 0 = off).resetVehicleIdleTimeResets the vehicle's idle counter, as if someone had just got out. The countdown to returning an abandoned vehicle (setVehicleIdleRespawnDelay) starts again. Useful e.g. when a player has parked the car in a garage and you want to give them more time.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).