Jump to content

Login Panel


Recommended Posts

addEventHandler ( 'onClientGUIClick', resourceRoot, 
function ( ) 
    if ( source == button ) then 
    local user = guiGetText ( Edit[1] )  
    local pass = guiGetText ( Edit[2] )  
    triggerServerEvent ( 'Login', localPlayer, user, pass ) 
  end 
end 
) 
Link to comment

Hey somebody help me i got an error : Loading script failed: login\client.lua:1: ' expected near '('

Here's my code..:

function() 
    LoginWindow = guiCreateWindow(370, 257, 306, 213, "cP~//Login Panel", false) 
    guiWindowSetMovable(LoginWindow, false) 
    guiWindowSetSizable(LoginWindow, false) 
  
    userlabel = guiCreateLabel(21, 49, 75, 26, "Username:", false, LoginWindow) 
    local font_0 = guiCreateFont(":font/digital.ttf") 
    guiSetFont(userlabel, font_0) 
    passlabel = guiCreateLabel(21, 93, 75, 26, "Password:", false, LoginWindow) 
    guiSetFont(passlabel, font_0) 
    useredit = guiCreateEdit(86, 49, 164, 30, "", false, LoginWindow) 
    passedit = guiCreateEdit(86, 89, 164, 30, "", false, LoginWindow) 
    registerbutton = guiCreateButton(37, 142, 102, 42, "Register", false, LoginWindow) 
    guiSetFont(registerbutton, font_0) 
    loginbutton = guiCreateButton(158, 142, 102, 42, "Login", false, LoginWindow) 
    guiSetFont(loginbutton, font_0)     
end 
  
    function ImagenFondo() 
        dxDrawImage(1, 0, 1023, 768, ":image/fondo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
    end 
  
addEventHandler("onClientResourceStart",resourceRoot, 
     
function Login () 
    local PlayerUser = guiGetText ( useredit ) 
    local PlayerPass = guiGetText ( passedit )   
    if PlayerUser ~= "" and PlayerPass ~= "" then 
        triggerServerEvent("onRequestLogin",getLocalPlayer(),PlayerUser,PlayerPass) 
    else 
        outputChatBox("#FF9e00Can't Login, if the problem persists contact an admin.",255,255,255,true) 
end 
end 
  
function Register () 
    local PlayerUser = guiGetText ( useredit ) 
    local PlayerPass = guiGetText ( passedit )   
    if PlayerUser ~= "" and PlayerPass ~= "" then 
        triggerServerEvent("onRequestRegister",getLocalPlayer(),login,pass,conf) 
    else 
        outputChatBox("#FF9e00Can't Register, if the problem persists contact an admin.",255,255,255,true) 
end 
end 
  
  
function xmlCheckFile() 
    local xmlFile = xmlLoadFile("account.xml") 
    if not xmlFile then 
        xmlFile = xmlCreateFile("account.xml","settings") 
        xmlNodeSetAttribute(xmlFile,"save",tostring(false)) 
        xmlNodeSetAttribute(xmlFile,"username","") 
        xmlNodeSetAttribute(xmlFile,"password","") 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
  
function loadXMLInfo() 
    local xmlFile = xmlLoadFile("account.xml") 
    if xmlFile then 
        local login = xmlNodeGetAttribute(xmlFile,"username") 
        local password = xmlNodeGetAttribute(xmlFile,"password") 
        local save = xmlNodeGetAttribute(xmlFile,"save") 
        if save == "true" then 
            guiSetText(loginEdit,login) 
            guiSetText(passwordEdit,password) 
            guiCheckBoxSetSelected(remember, true) 
        end 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
  
function saveXmlFile() 
    local xmlFile = xmlLoadFile("account.xml") 
    if not xmlFile then 
        xmlFile = xmlCreateFile("account.xml") 
    end 
    xmlNodeSetAttribute(xmlFile,"username",tostring(guiGetText(loginEdit))) 
    xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(passwordEdit))) 
    if (guiCheckBoxGetSelected(remember)) then 
        xmlNodeSetAttribute(xmlFile,"save",tostring(true)) 
    else 
        xmlNodeSetAttribute(xmlFile,"save",tostring(false)) 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 

Link to comment

  
    LoginWindow = guiCreateWindow(370, 257, 306, 213, "cP~//Login Panel", false) 
    guiWindowSetMovable(LoginWindow, false) 
    guiWindowSetSizable(LoginWindow, false) 
    userlabel = guiCreateLabel(21, 49, 75, 26, "Username:", false, LoginWindow) 
    local font_0 = guiCreateFont(":font/digital.ttf") 
    guiSetFont(userlabel, font_0) 
    passlabel = guiCreateLabel(21, 93, 75, 26, "Password:", false, LoginWindow) 
    guiSetFont(passlabel, font_0) 
    useredit = guiCreateEdit(86, 49, 164, 30, "", false, LoginWindow) 
    passedit = guiCreateEdit(86, 89, 164, 30, "", false, LoginWindow) 
    registerbutton = guiCreateButton(37, 142, 102, 42, "Register", false, LoginWindow) 
    guiSetFont(registerbutton, font_0) 
    loginbutton = guiCreateButton(158, 142, 102, 42, "Login", false, LoginWindow) 
    guiSetFont(loginbutton, font_0)     
  
    function ImagenFondo() 
        dxDrawImage(1, 0, 1023, 768, ":image/fondo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
    end 
  
    addEventHandler("onClientResourceStart",resourceRoot,ImagenFondo ) 
    
function Login () 
    local PlayerUser = guiGetText ( useredit ) 
    local PlayerPass = guiGetText ( passedit )  
    if PlayerUser ~= "" and PlayerPass ~= "" then 
        triggerServerEvent("onRequestLogin",getLocalPlayer(),PlayerUser,PlayerPass) 
    else 
        outputChatBox("#FF9e00Can't Login, if the problem persists contact an admin.",255,255,255,true) 
end 
end 
  
function Register () 
    local PlayerUser = guiGetText ( useredit ) 
    local PlayerPass = guiGetText ( passedit )  
    if PlayerUser ~= "" and PlayerPass ~= "" then 
        triggerServerEvent("onRequestRegister",getLocalPlayer(),login,pass,conf) 
    else 
        outputChatBox("#FF9e00Can't Register, if the problem persists contact an admin.",255,255,255,true) 
end 
end 
  
  
function xmlCheckFile() 
    local xmlFile = xmlLoadFile("account.xml") 
    if not xmlFile then 
        xmlFile = xmlCreateFile("account.xml","settings") 
        xmlNodeSetAttribute(xmlFile,"save",tostring(false)) 
        xmlNodeSetAttribute(xmlFile,"username","") 
        xmlNodeSetAttribute(xmlFile,"password","") 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
  
function loadXMLInfo() 
    local xmlFile = xmlLoadFile("account.xml") 
    if xmlFile then 
        local login = xmlNodeGetAttribute(xmlFile,"username") 
        local password = xmlNodeGetAttribute(xmlFile,"password") 
        local save = xmlNodeGetAttribute(xmlFile,"save") 
        if save == "true" then 
            guiSetText(loginEdit,login) 
            guiSetText(passwordEdit,password) 
            guiCheckBoxSetSelected(remember, true) 
        end 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
  
function saveXmlFile() 
    local xmlFile = xmlLoadFile("account.xml") 
    if not xmlFile then 
        xmlFile = xmlCreateFile("account.xml") 
    end 
    xmlNodeSetAttribute(xmlFile,"username",tostring(guiGetText(loginEdit))) 
    xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(passwordEdit))) 
    if (guiCheckBoxGetSelected(remember)) then 
        xmlNodeSetAttribute(xmlFile,"save",tostring(true)) 
    else 
        xmlNodeSetAttribute(xmlFile,"save",tostring(false)) 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
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...