Automatic Resource Restarter for FiveM
By: devilscurse
A little resource, I’ve made to restart a resource automatically after a certain amount of time.
Drag and drop ‘resource-restarter’ folder into your resources.
Config the ‘server.lua’ to the resource you want to restart and how long between.
Add ‘start resource-restarter’ into your ‘server.cfg’.
Add this at the top of your ‘server.cfg’ under your endpoints: #Automatic Resource Restarter
add_ace resource.resource-restarter command.restart allow
add_ace resource.resource-restarter command.start allow
add_ace resource.resource-restarter command.stop allow
Start your server up and enjoy!
Optional: 4.5. Add this to the top of the resource’s ‘client.lua’ then config the message and/or colour: TriggerEvent(“chatMessage”, “”, { 255, 0, 0 }, “your-resource is currently being restarted. You may experience minor lag!”
suppose that I want to start and stop a xx-resource with a specific time like… xx-resource will start after 1 hours and then that xx-resource will stop in 10 minutes. So should i have create two different scripts that you provided as a restart?
I crates these scripts like this:
1st script will stop the xx-resources after 10 minutes :
local delay = 1000 * 60 * 10
Citizen.CreateThread(function()
while true do
Citizen.Wait(delay)
ExecuteCommand(“stop xx-resoruce”)
end
end)
.
2nd script will start the xx-resource after 1 hour:
local delay = 1000 * 60 * 60
Citizen.CreateThread(function()
while true do
Citizen.Wait(delay)
ExecuteCommand(“start xx-resoruce”)
end
end)
.
Is it any good? and should i have to remove that xx-resource from server.cfg?