Jump to content

[APORTE] Export para iniciar - parar - reiniciar resources


Recommended Posts

Bueno no se si alguien creo esto o no se :/ es un script que ayuda a reiniciar, iniciar y parar los resources.

*Editado me confundi con el codigo estaba mal no me di cuenta (torpeza de mi parte)

  
function startresource (jugador, nameresource) 
if (nameresource) then 
local recurso = getResourceFromName ( nameresource ) 
     
    if not ( getResourceState(recurso) == "running" ) and ( recurso ) then 
    local start = startResource ( recurso )  
    else 
    outputChatBox ( "Este mapa ya esta activado o el nombre del mismo no esta bien escrito.", jugador, 255, 255, 255 ) 
    end 
  
else 
outputChatBox ( "No has escrito nada.", jugador, 255, 255, 255 ) 
end 
end 
  

  
function stopresource (jugador, nameresource) 
if (nameresource) then 
local recurso = getResourceFromName ( nameresource ) 
     
    if not ( getResourceState(recurso) == "stopping" ) and ( recurso ) then 
    local stop = stopResource ( recurso )    
    else 
    outputChatBox ( "Este mapa esta desactivado o el nombre del mismo no esta bien escrito.", jugador, 255, 255, 255 ) 
    end 
  
else 
outputChatBox ( "No has escrito nada.", jugador, 255, 255, 255 ) 
end 
end 
  

  
function restartresource (jugador, nameresource) 
if (nameresource) then 
local recurso = getResourceFromName ( nameresource ) 
     
    if ( getResourceState(recurso) == "running" ) and ( recurso ) then 
    local restart = restartResource ( recurso )  
    else 
    outputChatBox ( "Este mapa esta desactivado o el nombre del mismo no esta bien escrito.", jugador, 255, 255, 255 ) 
    end 
  
else 
outputChatBox ( "No has escrito nada.", jugador, 255, 255, 255 ) 
end 
end 
  

  
export: 
exports.resourcename:stopresource(source,"Casino_nivel") 
  
  
meta: 
    function="startresource" type="server" /> 
    function="startresource" type="client" /> 
     
    function="stopresource" type="server" /> 
    function="stopresource" type="client" /> 
     
    function="restartresource" type="server" /> 
    function="restartresource" type="client" /> 
  

Funciona bien en server, pero no he probado aun si funciona en cliente asi que si alguien lo puede testear estaria agradecido ya que no tengo mucho tiempo libre u.u

Ami me sirvio para desacivar el mismo resource que estaba corriendo con el mismo codigo sin bugs de por medio

Link to comment

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