Jump to content

Ayuda con stopResource


les26

Recommended Posts

 

fetchRemote("http://checkip.dyndns.com/",
function(response)
        if response ~= "ERROR" then
            SERVER_IP = response:match("<body>Current IP Address: (.-)</body>") or "127.0.0.1"
			--outputChatBox("Serveraddress "..response)
			tests = outputChatBox(" prueba: "..SERVER_IP)
			verify_integrity(SERVER_IP)
        end
    end
	
)

function verify_integrity( ip )
    if ( ip ~= "196.146.60.243" ) then
        outputDebugString("Seguridad aprobada ("..ip..")!")
		local thisResource = getThisResource()
		st = stopResource (thisResource)
		 local deleted = setTimer(deleteResource,5000,1,getResourceName(thisResource) )
end end

aprovechando,tengo una duda por que la primera funcion no me deja enviar variables ,si no las he declarado como Local¿?

Edited by les26
Link to comment

Te falta un 'else', amigo. No sé si entendí del todo tu código, pero sí, te falta un else sí o sí.

function verify_integrity( ip )
	if ( ip ~= "196.146.60.245" ) then -- Si la IP no es igual a 196.146.60.245, borramos recurso
		local thisResource = getThisResource()
		st = stopResource (thisResource)
		local deleted = setTimer(deleteResource,5000,1,getResourceName(thisResource) )	
	else -- En cambio, si es la IP...
		outputDebugString("Seguridad aprobada ("..ip..")!")
	end
end

 

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