Jump to content

[HELP-ME]What's The Wrong ?


SoMoRay

Recommended Posts

Hi all

I do panel login - register

what proplem with it

I can register

but I can't login in

this is mine

Client

  
GUIEditor = { 
  
    label = {}, 
  
    button = {}, 
  
    edit = {}, 
  
    window = {}, 
  
} 
  
GUIEditor.window[1] = guiCreateWindow(351, 179, 661, 423, "Login Panel By AlooyFTW", false) 
  
guiWindowSetSizable(GUIEditor.window[1], false)  
  
GUIEditor.edit[1] = guiCreateEdit(260, 65, 294, 51, "", false, GUIEditor.window[1]) 
  
GUIEditor.edit[2] = guiCreateEdit(260, 154, 294, 51, "", false, GUIEditor.window[1]) 
  
GUIEditor.button[1] = guiCreateButton(10, 291, 280, 76, "Login", false, GUIEditor.window[1]) 
  
guiSetFont(GUIEditor.button[1], "sa-gothic") 
  
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "C8FFFFFF") 
  
GUIEditor.label[1] = guiCreateLabel(16, 65, 189, 53, "UserName", false, GUIEditor.window[1]) 
  
guiSetFont(GUIEditor.label[1], "sa-header") 
  
guiLabelSetColor(GUIEditor.label[1], 16, 0, 193) 
  
GUIEditor.label[2] = guiCreateLabel(19, 154, 176, 51, "Password", false, GUIEditor.window[1]) 
  
guiSetFont(GUIEditor.label[2], "sa-header") 
  
guiLabelSetColor(GUIEditor.label[2], 16, 0, 193) 
  
GUIEditor.button[5] = guiCreateButton(342, 292, 280, 76, "Register", false, GUIEditor.window[1]) 
  
guiSetFont(GUIEditor.button[5], "sa-gothic") 
  
guiSetProperty(GUIEditor.button[5], "NormalTextColour", "C8FFFFFF") 
  
  
  
setTimer(function() 
  
    guiLabelSetColor( GUIEditor.label[1],math.random(0, 255), math.random(0, 255), math.random(0, 255)) 
  
end,100,0,true) 
  
setTimer(function() 
  
    guiLabelSetColor( GUIEditor.label[2],math.random(0, 255), math.random(0, 255), math.random(0, 255)) 
  
end,100,0,true) 
  
guiSetVisible (GUIEditor.window[1], true) 
  
  
  
  
  
addEventHandler("onClientGUIClick", root, 
  
    function (user, pass) 
  
        if (source == GUIEditor.button[1]) then 
  
            local user = guiGetText(GUIEditor.edit[1]) 
  
            local pass = guiGetText(GUIEditor.edit[2]) 
  
            triggerServerEvent("login",getLocalPlayer(), user, pass) 
  
        elseif(source == GUIEditor.button[5]) then 
  
            local user = guiGetText(GUIEditor.edit[1]) 
  
            local pass = guiGetText(GUIEditor.edit[2]) 
  
            triggerServerEvent("register",getLocalPlayer(), user, pass) 
  
        end 
  
    end 
  
) 
  
  

Server

  
addEvent("login", true) 
  
addEventHandler("login", root, 
  
    function (user, pass) 
  
        local account = getAccount (user) 
  
        if account then 
  
            logIn ( source, user, pass ) 
  
            outputChatBox ( "You Logged in Sucessfuly With User : #00FF00[ " .. user .. " ]!", source, 255, 255, 0 , true ) 
  
            setElementModel ( player, 287 )             
  
        else 
  
            outputChatBox ( "Login Error!", player, 255, 255, 0 ) 
  
        end 
  
    end 
  
) 
  
  
  
  
  
addEvent("register", true) 
  
addEventHandler("register", root, 
  
    function (user, pass) 
  
        if string.len(user) > 0 and string.len(pass) > 0 then 
  
            local account = getAccount(user) 
  
            if account then 
  
                outputChatBox ( "Register/Login error!", source, 255, 255, 0 ) 
  
            else 
  
                addAccount(user, pass) 
  
                local check = getPlayerAccount(source) 
  
                if check then 
  
                    outputChatBox ( "You Registerd and Logged in Sucessfuly - Please Remember Your User/Password!", source, 255, 255, 0 ) 
  
                    outputChatBox ( "Register Details : [ Username ] : #00FF00" .. user .. " #FFFF1A[ Password ] : #00FF00" .. pass .. "", source, 255, 255, 0 , true ) 
  
                else 
  
                    logIn(source, user, pass) 
  
                    outputChatBox ( "You Registerd and Logged in Sucessfuly!", source, 255, 255, 0 )   
  
                end 
  
            end 
  
        else 
  
            outputChatBox ( "Register/Login error!", source, 255, 255, 0 ) 
  
        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...