Amine#TN Posted January 29, 2017 Share Posted January 29, 2017 local respawn = 30 local r addCommandHandler("rav",function(player) if isTimer(r) then resetTimer(r) outputDebugString("Timer Reset") return end outputChatBox("RESPAWNING ALL UNOCCUPIED VEHICLES IN ".. respawn.."SECONDS") outputDebugString("Cars Respawning") r = setTimer(function() for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do -- For every vehicle do the following... if isEmpty( vehicle ) then resetVehicleIdleTime ( vehicle ) -- Reset the vehicle's idle time respawnVehicle ( vehicle ) end end outputDebugString("Cars Respawned") outputChatBox("ALL UNOCCUPIED VEHICLES RESPAWNED") end,respawn*1000,1) end) function isEmpty( vehicle ) local passengers = getVehicleMaxPassengers( vehicle ) if type( passengers ) == 'number' then for seat = 0, passengers do if getVehicleOccupant( vehicle, seat ) then return false end end end return true end i need a timer to restart the command respawn every 10min Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now