Automatic Resource Restarter

  Automatic Resource Restarter for FiveM
            By: devilscurse

A little resource, I’ve made to restart a resource automatically after a certain amount of time.

  1. Drag and drop ‘resource-restarter’ folder into your resources.

  2. Config the ‘server.lua’ to the resource you want to restart and how long between.

  3. Add ‘start resource-restarter’ into your ‘server.cfg’.

  4. 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

  5. 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!”

Download

5 Likes

Nice resource! I’ll be sure to try this when I get on my computer!

uhm, Why exactly would this be needed? :confused:

3 Likes

I saw some requests for an ELS restarter, so I just made a general one.

where i can put the 4.5 trigger event for the chat ?

In client.lua like he says :slight_smile:

not work !

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?

1 Like

I ain’t no professional and don’t know much about coding. But from what i know it should work, just try it out.