Brolis Posted August 9, 2012 Share Posted August 9, 2012 Hi all, today, I would like to ask you guys, how to make, from where to get, how to get and blah... a resource, that something would be look like that: If players is not in vehicles, after 10mins all server unused vehicles will be respawned to their positions with a alert messages: INFO: Attention! Unused server vehicles will be respawned after 10mins! INFO: Server vehicles successfully respawned! If you are in vehicle, that vehicle won't be spawned, just others unused vehicles. I know that that resource is existing, please help me, thanks a lot! Link to comment
Slide Posted August 9, 2012 Share Posted August 9, 2012 You can edit the time if you want https://community.multitheftauto.com/index.php?p= ... ls&id=3198 Link to comment
Brolis Posted August 12, 2012 Author Share Posted August 12, 2012 (edited) Please, fix this code, it doesn't writes all messages, it should write that all server unused vehicles will respawn in 15secs, in 10secs in 5secs and also all vehicles were respawned! function respawn() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("* Respawning all empty vehicles in 5sec, get to your car to keep it!") setTimer(function () local vehicles = getElementsByType ( "vehicle" ) for k, vehicle in ipairs ( vehicles ) do if checkEmpty( vehicle ) then local seats = getVehicleMaxPassengers(vehicle) resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end end, 5000, 1) end end addEvent( "respawn", true ) addEventHandler( "respawn", getRootElement(), respawn ) function respawn60() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("* Respawning all empty vehicles in 15 secs, get to your car to keep it!") setTimer(function () triggerServerEvent ( "respawn10", getLocalPlayer() ) end, 15000, 1) end end addEvent( "respawn60", true ) addEventHandler( "respawn60", getRootElement(), respawn60 ) function respawn10() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("* Respawning all empty vehicles in 10 secs, get to your car to keep it!") setTimer(function () triggerServerEvent ( "respawn", getLocalPlayer() ) end, 10000, 1) end end addEvent( "respawn10", true ) addEventHandler( "respawn10", getRootElement(), respawn10 ) function checkEmpty( 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 gess, you know what I mean to create, when you write a commands, it calls a timer to another function to do, after it calls that function other function calls other to respawn vehicles finally . Help me, thanks a lot! Edited August 12, 2012 by Guest Link to comment
Vision Posted August 12, 2012 Share Posted August 12, 2012 This? function respawn() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("* Respawning ALL Empty Vehicles In 5sec, get to your car to keep it!") setTimer(function () local vehicles = getElementsByType ( "vehicle" ) for k, vehicle in ipairs ( vehicles ) do if checkEmpty( vehicle ) then local seats = getVehicleMaxPassengers(vehicle) resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end end, 5000, 1) end end addEvent( "respawn", true ) addEventHandler( "respawn", getRootElement(), respawn ) function respawn60() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("* Respawning all empty vehicles in 10 mins, get to your car to keep it!") setTimer(function () triggerServerEvent ( "respawn10", getLocalPlayer() ) end, 600000, 1) end end addEvent( "respawn60", true ) addEventHandler( "respawn60", getRootElement(), respawn60 ) function respawn10() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then outputChatBox("* Respawning all empty vehicles in 10 secs, get to your car to keep it!") setTimer(function () triggerServerEvent ( "respawn", getLocalPlayer() ) end, 10000, 1) end end addEvent( "respawn10", true ) addEventHandler( "respawn10", getRootElement(), respawn10 ) function checkEmpty( 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 Link to comment
Brolis Posted August 12, 2012 Author Share Posted August 12, 2012 Error gone, but not what I wanted to. Doesn't write me a message after other message other message ... Help someone! Any suggestion?... 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