Jump to content

restartresource


villr

Recommended Posts

Posted

So i have some problems with my script im making.

The problem is when that things in script im making are "finished" with what they do i want to restart the script but it dont work

here is code

EDIT: randoms is name of script i wanna restart!

function restartthisscript() 
    local allResources = getResources() 
    for index, res in (randoms) do 
        if getResourceState(res) == "running" then 
            restartResource(res) 
        end 
    end 
end 

and here its the part to restart it

its more but thats just that

setTimer(restartthisscript, 6000, 1) 

Whats the problem?

Posted
function restartthisscript() 
  local res = getResourceFromName("randoms") 
  if getResourceState(res) == "running" then 
     restartResource(res) 
  end 
end 

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