Jump to content

Recurso automático se puede?


Recommended Posts

Posted

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" ) 

Posted

Eso no tiene mucho que ver con lo que vos queres hacer, no tomes un ejemplo que no es lo que vos queres, se te complica mas.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Eso no tiene mucho que ver con lo que vos queres hacer, no tomes un ejemplo que no es lo que vos queres, se te complica mas.

y como puedo hacer?

Posted
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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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?

Posted

Si, tenes que darle derechos en el acl.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

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