[Ska]Vladmo Posted March 26, 2008 Share Posted March 26, 2008 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
arc_ Posted March 26, 2008 Share Posted March 26, 2008 addEventHandler("onGamemodeMapStart", getRootElement(), function() for i,vehicle in ipairs(getElementsByType("vehicle")) do setVehicleIdleRespawnDelay(vehicle, 20000) end end ) Link to comment
eAi Posted March 26, 2008 Share Posted March 26, 2008 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
[Ska]Vladmo Posted March 26, 2008 Author Share Posted March 26, 2008 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
norby89 Posted March 26, 2008 Share Posted March 26, 2008 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
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