Jump to content

Error panel de login/registro


Xperia

Recommended Posts

Posted

Pues al iniciar el recurso de login/registro,no sale el panel, como si nada y me sale esto en el debugscript :

d985f428a4730c43b06115cd1a5781cao.jpg

Server:

--Login 
function playerLogin(username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts)   
    if not (username == "") then 
        if not (password == "") then 
            local account = getAccount (username, password) 
            if (account ~= false) then 
                logIn (source, account, password) 
                outputChatBox ("#ff0000* Has entrado correctamente.",source,255,255,255,true) 
                outputChatBox ("#ff0000* Para activar el autologin utiliza /on",source,255,255,255,true) 
                triggerClientEvent (source,"hideLoginWindow",getRootElement()) 
            else     
                if enableKickPlayer == true then 
                    if (attemptedLogins >= maxLoginAttempts-1) then 
                        outputChatBox ("#ff0000* Error",source,255,255,255,true) 
                        setTimer(outputChatBox,500,1,"#ff0000* Has alcanzado el numero maximo de intentos [#ff0000"..attemptedLogins+1 .."/"..maxLoginAttempts"]",source,255,255,255,true) 
                        setTimer(outputChatBox,1000,1,"#ff0000* Seras expulsado en 5 segundos",source,255,255,255,true) 
                        setTimer(kickPlayer,5000,1,source,"Logeo fallido") 
                    else 
                        outputChatBox ("#ff0000* Error",source,255,255,255,true) 
                        setTimer(outputChatBox,500,1,"#ff0000* Intentos:, [#ff0000"..attemptLogins+1 .."/"..maxLoginAttemps"#ff0000]",source,255,255,255,true) 
                        triggerClientEvent(source,"onRequestIncreaseAttempts",source) 
                    end 
                else     
                    outputChatBox("#ff0000* Usuario/contraseña incorrecto/a",source,255,255,255,true) 
                end 
            end 
        else 
            outputChatBox("#ff0000* Ingresa tu contraseña",source,255,255,255,true) 
        end  
    else     
        outputChatBox("#ff0000* Infresa tu nombre",source,255,255,255,true) 
    end 
end  
  
--Registro 
function playerRegister(username,password) 
    if not (username == "") then 
        if not (password == "") then 
            local account = getAccount (username,password) 
            if (account ~= false) then 
                local accountAdded = addAccount (tostring,(username),tostring,(password)) 
                if (accountAdded) then 
                    triggerClientEvent (source,"hideLoginWindow",getRootElement()) 
                    outputChatBox ("#ff0000* Has sido registrado como"..username.."ff0000.Recuerda tu contraseña:"..password.."#ff0000.",source,255,255,255,true) 
                    setTimer (outputChatBox,1000,1,"#ff0000* Bienvenido a mi servidor.",source,255,255,255,true)     
                else 
                outputChatBox ("#ff0000* Elige un nombre/contraseña distinto",source,255,255,255,true) 
                end 
            else     
            outputChatBox ("#ff0000* El nombre de usuario ya esta elegido",source,255,255,255,true) 
            end 
        else 
        outputChatBox ("#ff0000* Ingresa tu contraseña, por favor",source,255,255,255,true) 
        end 
    else 
    outputChatBox ("#ff0000* Ingresa tu nombre, por favor",source,255,255,255,true) 
    end 
end 
  
--Para cuando el juegador vuelva, le pida de nuevo el login 
function playerLogout () 
    triggerClientEvent (source,"onRequestDisplayPanel",source) 
end 
addEventHandler("onPlayerLogout",getRootElement(),playerLogout) 
  
--Eventos 
addEvent("onRequestLogin",true) 
addEvent("onRequestRegister",true) 
addEventHandler("onRequestLogin",getRootElement(),playerLogin) 
addEventHandler("onRequestRegister",getRootElement(),playerRegister)     

Client:

--Settings 
  
blackLoginScreen = true 
enableKickPlayer = true 
disallowLogout = false 
removeBlackScreenTime = 3 
maxLoginAttempts = 3 
  
-- 
  
addEvent("onRequestIncreaseAttempts",true) 
addEvent("onRequestDisplayPanel",true) 
  
function loginPanel() 
    local xmlFile = xmlLoadFile ("user.xml") 
        if xmlFile then 
            if (status == tostring(true)) then 
                if blackLoginScreen == true then 
                    fadecamera(false,0,0,0,0) 
                end  
                Panel = guiCreateWindow(307,297,625,352,"Login",false) 
                guiWindowSetMovable(Panel,false) 
                guiWindowSetSizable(Panel,false) 
             
                panelinfo = guiCreateMemo(34,34,373,168,"Panel de login - Hecho por Xperia^\n\nInfo. del servido:\n\nDueño: Xperia^\n\nPatrocinador: GPC - Great Players Club\n\n------------\n\nSkype: thexperiaplay\n\nCorreo: [email protected]\n\n",false,Panel) 
                guiMemoSetReadOnly(panelinfo,true) 
              
                foto = guiCreateStaticImage(369,58,264,200,"images/mtalogo.png",false,Panel) 
             
                nombre = guiCreateLabel(52,226,46,16,"Nombre",false,Panel) 
                guiSetFont(nombre,"default-bold-small") 
             
                contrasena = guiCreateLabel(52,254,68,16,"Contraseña",false,Panel) 
                guiSetFont(contrasena,"default-bold-small") 
             
                ponernombre = guiCreateEdit(134,223,272,22,"",false,Panel) 
             
                ponerpass = guiCreateEdit(135,252,272,22,"",false,Panel) 
             
                RegisterButton = guiCreateButton(218,301,184,29,"Registrarse",false,Panel) 
                guiSetFont(RegisterButton,"default-bold-small") 
             
                LoginButton = guiCreateButton(26,301,184,29,"Login",false,Panel) 
                guiSetFont(LoginButton,"default-bold-small") 
             
                GUIEditor_Scrollbar[1] = guiCreateScrollBar(381,38,17,156,true,false,Panel) 
             
                showCursor(true) 
                addEventHandler("onClientGuiClick",LoginButton,onClickLogin) 
                addEventHandler("onClientGuiClick",RegistterButton,onClickRegisterToggle) 
                addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts) 
                attemptedLogins = 0 
            end 
            xmlUnloadFile(xmlFile) 
        else 
            savexmlFile() 
        end 
        addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler) 
end      
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),loginPanel) 
  
--LOGIN  
function loginButton(button,state) 
    if (button == "left" and state == "up") then 
        if (source == loginButton) then 
            username = guiGetText(ponernombre) 
            password = guiGetText(ponerpass) 
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts) 
            saveXmlFile() 
        end  
    end  
end 
  
--REGISTRO 
function registerButton(button,state) 
    if (button == "left" and state == "up") then 
        if (source == RegisterButton) then 
            username = guiGetText(ponernombre) 
            password = guiGetText(ponerpass) 
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password) 
        end 
    end 
end 
  
--MOSTRAR VENTANA LOGIN 
function ventanaLoginOn() 
    guiSetVisible(panel,true) 
    guiSetInputEnabled(true) 
    showCursor(true) 
end 
addEvent("showLoginWindow",true) 
addEventHandler("showLoginWindow",getRootElement(),ventanaLoginOn)   
  
--QUITAR VENTANA LOGIN 
function ventanaLoginOff() 
    guiSetInputEnabled(false) 
    guiSetVisible(panel,false) 
    showCursor(false) 
    if blackLoginScreen == true then 
        fadeCamera (true,removeBlackScreenTime) 
    end  
end 
addEvent("hideLoginWindow",true) 
addEventHandler("hideLoginWindow",getRootElement(),ventanaLoginOff) 
  
--GUARDAR XML 
function saveXmlFile() 
    local xmlFile = xmlLoadFile("user.xml") 
    if not xmlFile then 
        xmlFile = xmlCreateFile("user.xml","settings") 
    end 
    xmlNodeSetAttibrute(xmlFile,"username",guiGetText,tostring(guiEditText("ponernombre"))) 
    xmlNodeSetAttribute(xmlFile,"password",guiGetText,tostring(guiEditText("ponerpass"))) 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
  
--INTENTOS 
function attempts() 
    attemptedLogins = attemptedLogins+1 
end  

430x73.png

430x73.png

Posted

Y con que activas la ventana? Tienes que usar esto en el "client"

addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),nombre de tu funcion) 

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

Posted

He puesto:

function loginPanel() 
    local xmlFile = xmlLoadFile ("user.xml") 
        if xmlFile then 
            if (status == tostring(true)) then 
                if blackLoginScreen == true then 
                    fadecamera(false,0,0,0,0) 
                end  
                Panel = guiCreateWindow(307,297,625,352,"Login",false) 
                guiWindowSetMovable(Panel,false) 
                guiWindowSetSizable(Panel,false) 
             
                panelinfo = guiCreateMemo(34,34,373,168,"Panel de login - Hecho por Xperia^\n\nInfo. del servido:\n\nDueño: Xperia^\n\nPatrocinador: GPC - Great Players Club\n\n------------\n\nSkype: thexperiaplay\n\nCorreo: [email protected]\n\n",false,Panel) 
                guiMemoSetReadOnly(panelinfo,true) 
              
                foto = guiCreateStaticImage(369,58,264,200,"images/mtalogo.png",false,Panel) 
             
                nombre = guiCreateLabel(52,226,46,16,"Nombre",false,Panel) 
                guiSetFont(nombre,"default-bold-small") 
             
                contrasena = guiCreateLabel(52,254,68,16,"Contraseña",false,Panel) 
                guiSetFont(contrasena,"default-bold-small") 
             
                ponernombre = guiCreateEdit(134,223,272,22,"",false,Panel) 
             
                ponerpass = guiCreateEdit(135,252,272,22,"",false,Panel) 
             
                RegisterButton = guiCreateButton(218,301,184,29,"Registrarse",false,Panel) 
                guiSetFont(RegisterButton,"default-bold-small") 
             
                LoginButton = guiCreateButton(26,301,184,29,"Login",false,Panel) 
                guiSetFont(LoginButton,"default-bold-small") 
             
                GUIEditor_Scrollbar[1] = guiCreateScrollBar(381,38,17,156,true,false,Panel) 
             
                 
                addEventHandler("onClientGuiClick",LoginButton,onClickLogin) 
                addEventHandler("onClientGuiClick",RegistterButton,onClickRegisterToggle) 
                addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts) 
                showCursor(true) 
                attemptedLogins = 0 
            end 
            xmlUnloadFile(xmlFile) 
        else 
            saveXmlFile(source) 
        end 
        addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler) 
end      
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel) 

Pero no va

430x73.png

430x73.png

Posted
He puesto:
function loginPanel() 
    local xmlFile = xmlLoadFile ("user.xml") 
        if xmlFile then 
            if (status == tostring(true)) then 
                if blackLoginScreen == true then 
                    fadecamera(false,0,0,0,0) 
                end  
                Panel = guiCreateWindow(307,297,625,352,"Login",false) 
                guiWindowSetMovable(Panel,false) 
                guiWindowSetSizable(Panel,false) 
             
                panelinfo = guiCreateMemo(34,34,373,168,"Panel de login - Hecho por Xperia^\n\nInfo. del servido:\n\nDueño: Xperia^\n\nPatrocinador: GPC - Great Players Club\n\n------------\n\nSkype: thexperiaplay\n\nCorreo: [email protected]\n\n",false,Panel) 
                guiMemoSetReadOnly(panelinfo,true) 
              
                foto = guiCreateStaticImage(369,58,264,200,"images/mtalogo.png",false,Panel) 
             
                nombre = guiCreateLabel(52,226,46,16,"Nombre",false,Panel) 
                guiSetFont(nombre,"default-bold-small") 
             
                contrasena = guiCreateLabel(52,254,68,16,"Contraseña",false,Panel) 
                guiSetFont(contrasena,"default-bold-small") 
             
                ponernombre = guiCreateEdit(134,223,272,22,"",false,Panel) 
             
                ponerpass = guiCreateEdit(135,252,272,22,"",false,Panel) 
             
                RegisterButton = guiCreateButton(218,301,184,29,"Registrarse",false,Panel) 
                guiSetFont(RegisterButton,"default-bold-small") 
             
                LoginButton = guiCreateButton(26,301,184,29,"Login",false,Panel) 
                guiSetFont(LoginButton,"default-bold-small") 
             
                GUIEditor_Scrollbar[1] = guiCreateScrollBar(381,38,17,156,true,false,Panel) 
             
                 
                addEventHandler("onClientGuiClick",LoginButton,onClickLogin) 
                addEventHandler("onClientGuiClick",RegistterButton,onClickRegisterToggle) 
                addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts) 
                showCursor(true) 
                attemptedLogins = 0 
            end 
            xmlUnloadFile(xmlFile) 
        else 
            saveXmlFile(source) 
        end 
        addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler)    
        addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),loginPanel) 

Pero no va

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

Posted

Prueba asi

--Login 
function playerLogin(username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts)   
    if not (username == "") then 
        if not (password == "") then 
            local account = getAccount (username, password) 
            if (account ~= false) then 
                logIn (source, account, password) 
                outputChatBox ("#ff0000* Has entrado correctamente.",source,255,255,255,true) 
                outputChatBox ("#ff0000* Para activar el autologin utiliza /on",source,255,255,255,true) 
                triggerClientEvent (source,"hideLoginWindow",getRootElement()) 
            else    
                if enableKickPlayer == true then 
                    if (attemptedLogins >= maxLoginAttempts-1) then 
                        outputChatBox ("#ff0000* Error",source,255,255,255,true) 
                        setTimer(outputChatBox,500,1,"#ff0000* Has alcanzado el numero maximo de intentos [#ff0000"..attemptedLogins+1 .."/"..maxLoginAttempts"]",source,255,255,255,true) 
                        setTimer(outputChatBox,1000,1,"#ff0000* Seras expulsado en 5 segundos",source,255,255,255,true) 
                        setTimer(kickPlayer,5000,1,source,"Logeo fallido") 
                    else 
                        outputChatBox ("#ff0000* Error",source,255,255,255,true) 
                        setTimer(outputChatBox,500,1,"#ff0000* Intentos:, [#ff0000"..attemptLogins+1 .."/"..maxLoginAttemps"#ff0000]",source,255,255,255,true) 
                        triggerClientEvent(source,"onRequestIncreaseAttempts",source) 
                    end 
                else    
                    outputChatBox("#ff0000* Usuario/contrasena incorrecto/a",source,255,255,255,true) 
                end 
            end 
        else 
            outputChatBox("#ff0000* Ingresa tu contrasena",source,255,255,255,true) 
        end  
    else    
        outputChatBox("#ff0000* Infresa tu nombre",source,255,255,255,true) 
    end 
end  
  
--Registro 
function playerRegister(username,password) 
    if not (username == "") then 
        if not (password == "") then 
            local account = getAccount (username,password) 
            if (account ~= false) then 
                local accountAdded = addAccount (tostring,(username),tostring,(password)) 
                if (accountAdded) then 
                    triggerClientEvent (source,"hideLoginWindow",getRootElement()) 
                    outputChatBox ("#ff0000* Has sido registrado como"..username.."ff0000.Recuerda tu contrasena:"..password.."#ff0000.",source,255,255,255,true) 
                    setTimer (outputChatBox,1000,1,"#ff0000* Bienvenido a mi servidor.",source,255,255,255,true)    
                else 
                outputChatBox ("#ff0000* Elige un nombre/contrasena distinto",source,255,255,255,true) 
                end 
            else    
            outputChatBox ("#ff0000* El nombre de usuario ya esta elegido",source,255,255,255,true) 
            end 
        else 
        outputChatBox ("#ff0000* Ingresa tu contrasena, por favor",source,255,255,255,true) 
        end 
    else 
    outputChatBox ("#ff0000* Ingresa tu nombre, por favor",source,255,255,255,true) 
    end 
end 
  
--Para cuando el juegador vuelva, le pida de nuevo el login 
function playerLogout () 
    triggerClientEvent (source,"onRequestDisplayPanel",source) 
end 
addEventHandler("onPlayerLogout",getRootElement(),playerLogout) 
  
--Eventos 
addEvent("onRequestLogin",true) 
addEvent("onRequestRegister",true) 
addEventHandler("onRequestLogin",getRootElement(),playerLogin) 
addEventHandler("onRequestRegister",getRootElement(),playerRegister)   

--Settings 
  
blackLoginScreen = true 
enableKickPlayer = true 
disallowLogout = false 
removeBlackScreenTime = 3 
maxLoginAttempts = 3 
  
-- 
  
addEvent("onRequestIncreaseAttempts",true) 
addEvent("onRequestDisplayPanel",true) 
  
function loginPanel() 
    local xmlFile = xmlLoadFile ("user.xml") 
        if xmlFile then 
            if (status == tostring(true)) then 
                if blackLoginScreen == true then 
                    fadecamera(false,0,0,0,0) 
                end  
                Panel = guiCreateWindow(307,297,625,352,"Login",false) 
                guiWindowSetMovable(Panel,false) 
                guiWindowSetSizable(Panel,false) 
            
                panelinfo = guiCreateMemo(34,34,373,168,"Panel de login - Hecho por Xperia^\n\nInfo. del servido:\n\nDueno: Xperia^\n\nPatrocinador: GPC - Great Players Club\n\n------------\n\nSkype: thexperiaplay\n\nCorreo: [email protected]\n\n",false,Panel) 
                guiMemoSetReadOnly(panelinfo,true) 
              
                foto = guiCreateStaticImage(369,58,264,200,"images/mtalogo.png",false,Panel) 
            
                nombre = guiCreateLabel(52,226,46,16,"Nombre",false,Panel) 
                guiSetFont(nombre,"default-bold-small") 
            
                contrasena = guiCreateLabel(52,254,68,16,"Contrasena",false,Panel) 
                guiSetFont(contrasena,"default-bold-small") 
            
                ponernombre = guiCreateEdit(134,223,272,22,"",false,Panel) 
            
                ponerpass = guiCreateEdit(135,252,272,22,"",false,Panel) 
            
                RegisterButton = guiCreateButton(218,301,184,29,"Registrarse",false,Panel) 
                guiSetFont(RegisterButton,"default-bold-small") 
            
                LoginButton = guiCreateButton(26,301,184,29,"Login",false,Panel) 
                guiSetFont(LoginButton,"default-bold-small") 
            
                GUIEditor_Scrollbar[1] = guiCreateScrollBar(381,38,17,156,true,false,Panel) 
            
                showCursor(true) 
                addEventHandler("onClientGuiClick",LoginButton,onClickLogin) 
                addEventHandler("onClientGuiClick",RegistterButton,onClickRegisterToggle) 
                addEventHandler("onRequestIncreaseAttempts",getRootElement(),increaseAttempts) 
                attemptedLogins = 0 
            end 
            xmlUnloadFile(xmlFile) 
        else 
            savexmlFile() 
        end 
        addEventHandler("onRequestDisplayPanel",getRootElement(),logoutHandler) 
end     
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),loginPanel) 
  
--LOGIN 
function loginButton(button,state) 
    if (button == "left" and state == "up") then 
        if (source == loginButton) then 
            username = guiGetText(ponernombre) 
            password = guiGetText(ponerpass) 
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts) 
            saveXmlFile() 
        end  
    end  
end 
  
--REGISTRO 
function registerButton(button,state) 
    if (button == "left" and state == "up") then 
        if (source == RegisterButton) then 
            username = guiGetText(ponernombre) 
            password = guiGetText(ponerpass) 
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password) 
        end 
    end 
end 
  
--MOSTRAR VENTANA LOGIN 
function ventanaLoginOn() 
    guiSetVisible(panel,true) 
    guiSetInputEnabled(true) 
    showCursor(true) 
end 
addEvent("showLoginWindow",true) 
addEventHandler("showLoginWindow",getRootElement(),ventanaLoginOn)  
  
--QUITAR VENTANA LOGIN 
function ventanaLoginOff() 
    guiSetInputEnabled(false) 
    guiSetVisible(panel,false) 
    showCursor(false) 
    if blackLoginScreen == true then 
        fadeCamera (true,removeBlackScreenTime) 
    end  
end 
addEvent("hideLoginWindow",true) 
addEventHandler("hideLoginWindow",getRootElement(),ventanaLoginOff) 
  
--GUARDAR XML 
function saveXmlFile() 
    local xmlFile = xmlLoadFile("user.xml") 
    if not xmlFile then 
        xmlFile = xmlCreateFile("user.xml","settings") 
    end 
    xmlNodeSetAttibrute(xmlFile,"username",guiGetText,tostring(guiEditText("ponernombre"))) 
    xmlNodeSetAttribute(xmlFile,"password",guiGetText,tostring(guiEditText("ponerpass"))) 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
  
--INTENTOS 
function attempts() 
    attemptedLogins = attemptedLogins+1 
end  

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
Posted

Ahora no sale nada ni en la consola ni en el debug.Y cuando pongo el resource de Nextreme, al logearme, me sale la bienvenida del chat del resource y del mio.

430x73.png

430x73.png

  • Recently Browsing   0 members

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