Jump to content

Recurso automático se puede?


Recommended Posts

Hola amigos, necesito un resource que haga reiniciar a otro resource osea automáticamente por un tiempo determinado, pero la verdad ni siquiera se como intente usar esto, osea quiero reiniciar automáticamente un resource llamado licencia y no se donde poner el nombre del resource ni como ordenar lo de abajo

function startTheResource ( thePlayer, command, resourceName ) 
    if ( resourceName ) then -- Check if they specified a resource name 
        local resource = getResourceFromName ( resourceName ) -- Get the resource 
  
        local start = startResource ( resource ) -- Start the resource 
        if ( start ) then -- If it was successfully started... 
            outputChatBox ( resourceName .. " was started successfully.", thePlayer, 255, 0, 0 ) 
        else -- If it wasn't successfully started... 
            outputChatBox ( "This resource doesn't exist.", thePlayer, 255, 0, 0 ) 
        end 
    else -- If they didn't put a resource name... 
        outputChatBox ( "Please specify a resource to start.", thePlayer, 255, 0, 0 ) 
    end 
end 
  
function stopAllResources() 
    -- we store a table of resources 
    local allResources = getResources() 
    -- for each one of them, 
    for i, resource in ipairs(allResources) do 
        -- if it's running, and it is not the current resource 
        if ( getResourceState(resource) == "running" ) and ( resource ~= getThisResource() ) then 
            -- then stop it 
            stopResource(resource) 
        end 
    end 
end 
  
-- define function to be called 
function delayedChat ( text ) 
    outputChatBox ( "Delayed text: " .. text ) 
end 
  
-- set a timer so the function is called after 1 second 
setTimer ( delayedChat, 1000, 1, "el resource ha sido reiniciado" ) 

Link to comment
function startDelayedResource ( ) 
    local resource = getResourceFromName ( "licencia" ) 
    if ( resource ) then 
        startResource ( resource ) 
        outputChatBox ( "The resource 'licencia' is now running!" ) 
    else 
        outputChatBox ( "The resource 'licencia' doesn't exist!" ) 
    end 
end 
setTimer ( startDelayedResource, 1000, 1 ) 

Link to comment
function startDelayedResource ( ) 
    local resource = getResourceFromName ( "licencia" ) 
    if ( resource ) then 
        startResource ( resource ) 
        outputChatBox ( "The resource 'licencia' is now running!" ) 
    else 
        outputChatBox ( "The resource 'licencia' doesn't exist!" ) 
    end 
end 
setTimer ( startDelayedResource, 1000, 1 ) 

Y si le quiero sacar el mensaje le borro el outputChatBox?

le tengo que dar derechos en acl o algo?

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...