Jump to content

[Problem] login panel top memo list


Lucario

Recommended Posts

Hi all, i want to create a top memo list for a alredy created login panel, like cit, but with other options, top killer, top dier, top drifter, top richer, top with more ping, top cop, top gang with more members, top player with more time, top player with more level (experience) and top player with more ratio, like scoreboard, and refresh it every 5 seconds, what i must use?

My login panel client code (where must be the memo):

label = {} 
  
ventanalogin = guiCreateWindow(102, 167, 636, 280, "", false) 
guiWindowSetSizable(ventanalogin, false) 
guiSetAlpha(ventanalogin, 0.90) 
  
lgnBtn = guiCreateButton(9, 228, 134, 37, "Entrar", false, ventanalogin) 
RgsBtn = guiCreateButton(145, 228, 134, 37, "Registrarse", false, ventanalogin) 
InvBtn = guiCreateButton(281, 228, 134, 37, "Entrar como invitado", false, ventanalogin) 
somos = guiCreateButton(9, 199, 141, 23, "¿Quienes somos?", false, ventanalogin) 
juralogo = guiCreateStaticImage(9, 16, 411, 121, "logo.png", false, ventanalogin) 
label[1] = guiCreateLabel(15, 141, 45, 15, "Usuario:", false, ventanalogin) 
label[2] = guiCreateLabel(15, 176, 65, 15, "Contraseña:", false, ventanalogin) 
usuario = guiCreateEdit(61, 139, 179, 20, "", false, ventanalogin) 
clave = guiCreateEdit(81, 174, 179, 20, "", false, ventanalogin) 
info = guiCreateLabel(425, 27, 205, 166, "Bienvenido a Juramento Freeroam \n\nAqui Disfrutaran de Skins, Carros \nReales, Carreras, \nEventos, Trabajos, Etc \n\nSkins: \nLeon Kenedy:15, Wesker:123, \nGoku:107, Crysis:28\n\nCarro Real: \nBuffalo", false, ventanalogin) 
guiSetFont(info, "default-bold-small") 
guiLabelSetColor(info, 0, 255, 0) 
reglas = guiCreateButton(424, 199, 141, 23, "Reglamento", false, ventanalogin) 
showCursor(true) 
  
function rules() 
guiSetText(info,"REGLAMENTO DEL SERVIDOR:\n\n- NO SPAM\n- NO INSULTOS\n- NO PEDIR PODER ADMINISTRATIVO\n- NO  FLOOD/INUNDAR EL CHAT\n- NO ABUSAR DE BUGS\n- NO PELEAR\n- RESPETAR A MIEMBROS [JURA]\n- RESPETAR A ADMINISTRADORES\n- DIVERTIRSE") 
end 
addEventHandler("onClientGUIClick",reglas,rules,false) 
  
function infojura() 
guiSetText(info,"Somos una Pequeña Comunidad, la\nCual Se Encuentra Cada Vez Mas en\nCrecimiento.\nSitio Oficial: \n\n[url=http://www.mtajuraclan.blogspot.com]http://www.mtajuraclan.blogspot.com[/url] \n\nForo Oficial: \n\n[url=http://www.mtajuraclan.foroactivo.com]http://www.mtajuraclan.foroactivo.com[/url]") 
end 
addEventHandler("onClientGUIClick",somos,infojura,false) 
  
addEvent("cerrarLogin",true) 
function cerrarLogin() 
guiSetVisible(ventanalogin, not guiGetVisible(ventanalogin)) 
guiSetVisible(ventanalogin,false) 
showCursor(false) 
end 
addEventHandler("cerrarLogin",getRootElement(),cerrarLogin) 
addEventHandler("onClientGUIClick",InvBtn,cerrarLogin,false) 
  
  
function onRegisterKlick () 
   local username = guiGetText(usuario) 
   local password = guiGetText(clave) 
   if username ~= "" and password ~= "" then 
     triggerServerEvent("register",getLocalPlayer(),getLocalPlayer(),username,password) 
showCursor(false) 
     end 
end 
  
addEventHandler("onClientGUIClick",RgsBtn,onRegisterKlick,false) 
  
  
  
function onLoginKlick () 
   local username = guiGetText(usuario) 
   local password = guiGetText(clave) 
   if username ~= "" and password ~= "" then      
        triggerServerEvent("login",getLocalPlayer(),getLocalPlayer(),username,password) 
  
showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",lgnBtn,onLoginKlick,false) 

Link to comment

I have just finished the login panel, but i have a very bad error, attempt to load global load xmlLoginFromXML a nil value, here is the code, i used debugscript 3:

GUIEditor = { 
    checkbox = {}, 
    staticimage = {}, 
    edit = {}, 
    button = {}, 
    window = {}, 
    label = {}, 
    memo = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        ventanalogin = guiCreateWindow(193, 39, 887, 694, "Panel de Login Juramento", false) 
        guiWindowSetSizable(ventanalogin, false) 
  
        top = guiCreateMemo(9, 434, 868, 250, "", false, ventanalogin) 
        juralogo = guiCreateStaticImage(14, 26, 267, 208, ":login_panel/logo.png", false, ventanalogin) 
        usuario = guiCreateLabel(286, 76, 147, 41, "Usuario:", false, ventanalogin) 
        guiSetFont(usuario, "sa-header") 
        clave = guiCreateLabel(286, 149, 192, 40, "Contraseña:", false, ventanalogin) 
        guiSetFont(clave, "sa-header") 
        Edit_Login = guiCreateEdit(482, 76, 159, 41, "", false, ventanalogin) 
        Edit_Password = guiCreateEdit(483, 149, 159, 40, "", false, ventanalogin) 
        lgnBtn = guiCreateButton(684, 86, 193, 91, "Entrar", false, ventanalogin) 
        guiSetFont(lgnBtn, "sa-header") 
        guiSetProperty(lgnBtn, "NormalTextColour", "FF0000FF") 
        guardar1 = guiCreateCheckBox(651, 159, 15, 16, "", true, false, ventanalogin) 
        guardar2 = guiCreateCheckBox(651, 86, 15, 15, "", true, false, ventanalogin) 
        recordar = guiCreateLabel(578, 27, 172, 39, "-Recordar-", false, ventanalogin) 
        guiSetFont(recordar, "sa-header") 
        usuario2 = guiCreateLabel(285, 265, 192, 41, "Usuario:", false, ventanalogin) 
        guiSetFont(usuario2, "sa-header") 
        clave2 = guiCreateLabel(285, 340, 192, 41, "Contraseña:", false, ventanalogin) 
        guiSetFont(clave2, "sa-header") 
        Edit_Login2 = guiCreateEdit(482, 265, 159, 41, "", false, ventanalogin) 
        Edin_Password2 = guiCreateEdit(482, 340, 159, 41, "", false, ventanalogin) 
        RgsBtn = guiCreateButton(684, 275, 193, 101, "Registrarse", false, ventanalogin) 
        guiSetFont(RgsBtn, "sa-header") 
        showCursor(true) 
        info = guiCreateMemo(14, 241, 267, 183, "Bienvenid@ a Juramento Freeroam.\n\nAqui Disfrutaran de Skins, Carros Reales, Carreras, Eventos, Trabajos, Zombies, Clanes, Y Mucho Mas.\n\nForo Oficial:\n[url=http://www.mtajuraclan.foroactivo.com]http://www.mtajuraclan.foroactivo.com[/url]\n\nSitio Oficial:\n[url=http://www.mtajuraclan.blogspot.com]http://www.mtajuraclan.blogspot.com[/url]", false, ventanalogin)     
    end 
    ) 
     
    if not( username == "" or password == "") then 
        guiCheckBoxSetSelected ( guardar1, true ) 
        guiSetText ( Edit_Login, tostring(username)) 
        guiCheckBoxSetSelected ( guardar2, true ) 
        guiSetText ( Edit_Password, tostring(password)) 
    else 
        guiCheckBoxSetSelected ( guardar1, false ) 
        guiSetText ( Edit_Login, tostring(username)) 
        guiCheckBoxSetSelected ( guardar2, false ) 
        guiSetText ( Editn-Password, tostring(password)) 
    end 
     
    addEventHandler("onClientGUIClick",lgnBtn,onClickBtnLogin) 
    addEventHandler("onClientGUIClick",RgsBtn,onClickBtnRegister) 
  
  
function onRegisterKlick () 
   local username = guiGetText(username) 
   local password = guiGetText(password) 
   if username ~= "" and password ~= "" then 
     triggerServerEvent("register",getLocalPlayer(),getLocalPlayer(),username,password) 
showCursor(false) 
     end 
end 
  
addEventHandler("onClientGUIClick",RgsBtn,onRegisterKlick,false) 
  
  
  
function onLoginKlick () 
   local username = guiGetText(username) 
   local password = guiGetText(password) 
   if username ~= "" and password ~= "" then      
        triggerServerEvent("login",getLocalPlayer(),getLocalPlayer(),username,password) 
  
showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",lgnBtn,onLoginKlick,false) 
  
function loadLoginFromXML() 
    local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") 
    if not xml_save_log_File then 
        xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") 
    end 
    local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) 
    local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) 
    if usernameNode and passwordNode then 
        return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) 
    else 
        return "", "" 
    end 
    xmlUnloadFile ( xml_save_log_File ) 
end 
  
  
function saveLoginToXML(username, password) 
    local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") 
    if not xml_save_log_File then 
        xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") 
    end 
    if (username ~= "") then 
        local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) 
        if not usernameNode then 
            usernameNode = xmlCreateChild(xml_save_log_File, "password") 
        end 
        xmlNodeSetValue (usernameNode, tostring(username)) 
    end 
    if (password ~= "") then 
        local passwordNode = xmlFindChild (xml_save_log_File, "username", 0) 
        if not passwordNode then 
            passwordNode = xmlCreateChild(xml_save_log_File, "password") 
        end      
        xmlNodeSetValue (passwordNode, tostring(password)) 
    end 
    xmlSaveFile(xml_save_log_File) 
    xmlUnloadFile (xml_save_log_File) 
end 
addEvent("saveLoginToXML", true) 
addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) 
  
  
  
function resetSaveXML() 
        local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") 
        if not xml_save_log_File then 
            xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") 
        end 
        if (username ~= "") then 
            local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) 
            if not usernameNode then 
                usernameNode = xmlCreateChild(xml_save_log_File, "username") 
            end 
        end 
        if (password ~= "") then 
            local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) 
            if not passwordNode then 
                passwordNode = xmlCreateChild(xml_save_log_File, "password") 
            end      
            xmlNodeSetValue (passwordNode, "") 
        end 
        xmlSaveFile(xml_save_log_File) 
        xmlUnloadFile (xml_save_log_File) 
end 
addEvent("resetSaveXML", true) 
addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) 

And i have the top list empty, for put the top list, how i can put there the top list, top killer, top dier, top richer, top drifter, etc.

Link to comment

You can't just put the top players out of nowhere. You need to save the stats somewhere and then load them to show the "top" players. I suggest you use element data to store the top players temporarily and save them to SQL or MySQL database from time to time eg. 10 minutes, when they log out or quit the server (when player leaves his element data stats will be lost so they need to be saved somewhere). It all depends how other scripts work if you have them. If you don't have any scripts that track/save players' stats then you won't be able to show these players in the edit box. Like I said earlier, you have to save the stats first before you can show them. Also, when you're posting an error make sure you copy the exact message and at which line it occurred.

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