Jump to content

VehicleIdleRespawnDelay


Recommended Posts

Here is an example:

theVehicle = createVehicle ( 400, 1, 1, 1 )       -- create us a new vehicle 
  
if ( theVehicle ) then 
    setVehicleIdleRespawnDelay ( theVehicle, 20000 ) -- tell the server to respawn the vehicle 20 seconds after it's been left. 
end 

How would I make it so it respawns the vehicle because someone has left it and it has been idle and it respawns after 20 seconds for the .map file vehicles?

Thanks in advance

Link to comment
addEventHandler("onGamemodeMapStart", getRootElement(), 
    function() 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            setVehicleIdleRespawnDelay(vehicle, 20000) 
        end 
    end 
) 

Link to comment

You should in theory be able to do:

setVehicleIdleRespawnDelay(root, 20000)

Which should work for all the vehicles - might want to test it though. Most functions should work like this, if they don't please tell us so we can fix it.

Link to comment
addEventHandler("onGamemodeMapStart", getRootElement(), 
    function() 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            setVehicleIdleRespawnDelay(vehicle, 20000) 
        end 
    end 
) 

Could I make it

addEventHandler("onGamemodeMapStart", getRootElement(), idleRespawn ) 
    function idleRespawn () 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            setVehicleIdleRespawnDelay(vehicle, 20000) 
        end 
    end 
  

Link to comment

try this instead

  
    function idleRespawn () 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            setVehicleIdleRespawnDelay(vehicle, 20000) 
        end 
    end 
addEventHandler("onGamemodeMapStart", getRootElement(), idleRespawn ) 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...