Jump to content

automatically restart


Estevam2d

Recommended Posts

Posted
function restartAllResources() 
    local allResources = getResources() 
    for index, res in ipairs(allResources) do 
        if getResourceState(res) == "JOBpl" then 
            restartResource(res) 
        end 
    end 
end 
addCommandHandler( "pl", restartAllResources ) 

how can I put a time to start and stop automatically activated without charge?

I think this script is wrong.

Posted

You want to restart only the resource "JOBpl"?

function restartRes ( ) 
    local res = getResourceFromName ( "JOBpl" ) 
    if ( res ) then 
        restartResource ( res ) 
    end 
end 
setTimer ( restartRes, 60000, 0 ) 

Posted

Try this:

setTimer(function () 
    local allResources = getResources() 
    for index, res in ipairs(allResources) do 
        if getResourceState(res) == "JOBpl" then 
            restartResource(res) 
        end 
    end 
    end,60000,0) 

It will restart the resources after one minute.

Posted

You want only vehicle created from JOBpl to be destroyed?

You can use getResourceRootElement.

addEventHandler("onVehicleExplode", getResourceRootElement(getResourceFromName("JOBpl")), 
function() 
    destroyElement(source) 
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...