depato123 Posted May 18, 2013 Share Posted May 18, 2013 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
Castillo Posted May 18, 2013 Share Posted May 18, 2013 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. Link to comment
depato123 Posted May 18, 2013 Author Share Posted May 18, 2013 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? Link to comment
Castillo Posted May 18, 2013 Share Posted May 18, 2013 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
depato123 Posted May 18, 2013 Author Share Posted May 18, 2013 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
Castillo Posted May 18, 2013 Share Posted May 18, 2013 Si, tenes que darle derechos en el acl. Link to comment
Recommended Posts