Jump to content

need help in login panel


darhal

Recommended Posts

hey all

i made the gui in the client side and i made the half of the serveur side it s should work but " couldnt find login-s"appear in F8

I m a newbie scripter so .. help plz

Serveur side

addEvent("Login", true) 
addEvent("Register", true) 
  
function loginHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent (source, "hideLoginWindow", source) 
  
    end 
  
    end 
end 
addEventHandler("Login", root, loginHandler) 
  
function registerHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        outputChatBox( "", root, 255, 255, 255 ) 
    else 
        account = addAccount(username, password) 
        if (logIn(source, account, password) == true) then 
            triggerClientEvent(source, "hideRegisterWindow", getRootElement()) 
  
        end 
    end 
end 
addEventHandler("Register", root, registerHandler) 

client side

GUIEditor = { 
    tab = {}, 
    label = {}, 
    tabpanel = {}, 
    edit = {}, 
    gridlist = {}, 
    window = {}, 
    button = {}, 
    memo = {} 
} 
-- Main window 
LoginWindow["mainWindow"] = guiCreateWindow(75, 18, 671, 549, "CUP login Panel", false) 
guiWindowSetSizable(LoginWindow["mainWindow"], false) 
guiSetInputEnabled( true ) 
showCursor(true) 
-- Gridlist 
GridList["mainlist"] = guiCreateGridList(9, 22, 652, 517, false, LoginWindow["mainWindow"]) 
-- Login 
loginLabel["Username"] = guiCreateLabel(23, 33, 94, 33, "Username :", false, loginWindow["mainWindow"]) 
guiSetFont(loginLabel["Username"], "clear-normal") 
loginEdit["Username"] = guiCreateEdit(117, 35, 144, 41, "", false, loginWindow["mainWindow"]) 
loginLabel["Password"] = guiCreateEdit(117, 101, 144, 41, "", false, loginWindow["mainWindow"]) 
loginLabel["Password"] = guiCreateLabel(23, 101, 94, 33, "Password :", false, loginWindow["mainWindow"]) 
guiSetFont(loginLabel["Password"], "clear-normal") 
loginButton["Main"] = guiCreateButton(292, 38, 140, 48, "Login", false, loginWindow["mainWindow"]) 
-- main 
RegisterButton["Main"] = guiCreateButton(292, 94, 140, 48, "Register", false, loginWindow["mainWindow"]) 
Forget-PasswordButton["Main"] = guiCreateButton(22, 160, 152, 52, "Forget-Password ?", false, loginWindow["mainWindow"]) 
Serveur-Infobutton["Main"] = guiCreateButton(195, 160, 152, 52, "Server-Info", false, loginWindow["mainWindow"]) 
Serveur-Rulesbutton["Main"] = guiCreateButton(365, 160, 152, 52, "Serveur-Rules", false, loginWindow["mainWindow"]) 
Updates.tabpanel[1] = guiCreateTabPanel(6, 223, 641, 284, false, GridList["mainlist"]) 
updates.tab["Main"] = guiCreateTab("Updates", Updates.tabpanel[1]) 
-- memo 
Updates.memo["Main"] = guiCreateMemo(0, 0, 641, 259, "Server Open !!!\nWelcome", false, Updates.tab["Main"]) 
-- Register 
GUIEditor = { 
    checkbox = {}, 
    edit = {}, 
    button = {}, 
    window = {}, 
    label = {}, 
    combobox = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        registerWindow["mainWindow"] = guiCreateWindow(213, 0, 383, 586, "Register", false) 
        guiWindowSetSizable(registerWindow["mainWindow"], false) 
        centerWindow( registerWindow["mainWindow"] ) 
  
        welcomeLabel["mainWindow"] = guiCreateLabel(8, 30, 364, 38, "Welcome to CUP fill the following blanks to have an account !", false, welcomeLabel["mainWindow"]) 
        registerlabel["Username :"] = guiCreateLabel(15, 70, 123, 41, "Username :", false, registerWindow["mainWindow"]) 
        guiSetFont(registerlabel["Username :"], "clear-normal") 
  
        registerEdit["Username"] = guiCreateEdit(135, 1, 15, 30, "", false, registerWindow["mainWindow"]) 
  
        GUIEditor.edit[2] = guiCreateEdit(141, 71, 170, 40, "", false, registerWindow["mainWindow"]) 
        registerLabel["Password"] = guiCreateLabel(15, 148, 123, 41, "Password :", false, registerWindow["mainWindow"]) 
        guiSetFont(registerLabel["Password"], "clear-normal") 
        registerEdit["Password"] = guiCreateEdit(141, 148, 170, 40, "", false, registerWindow["mainWindow"]) 
        registerLabel["Repeat-Password"] = guiCreateLabel(15, 228, 123, 41, "Repeat-Password :", false, registerWindow["mainWindow"]) 
        guiSetFont(registerLabel["Repeat-Password"], "clear-normal") 
        registerEdit["Repeat-Password"] = guiCreateEdit(141, 228, 170, 40, "", false, registerWindow["mainWindow"]) 
        registerLabel["E-mail"] = guiCreateLabel(15, 310, 123, 41, "E-mail :", false, registerWindow["mainWindow"]) 
        guiSetFont(registerLabel["E-mail"], "clear-normal") 
        registerEdit["E-mail"] = guiCreateEdit(141, 311, 170, 40, "", false, registerWindow["mainWindow"]) 
        registerLabel["Choose"] = guiCreateLabel(20, 362, 340, 36, "Choose the city which you went to Spawn in \nand don't forget to choose a Skin .", false, registerWindow["mainWindow"]) 
        registerCheckbox["LS"] = guiCreateCheckBox(14, 408, 16, 18, "", false, false, registerWindow["mainWindow"]) 
        registerLabel["LS"] = guiCreateLabel(34, 410, 19, 16, "LS", false, registerWindow["mainWindow"]) 
        guiSetFont(registerLabel["LS"], "default-bold-small") 
  
        registerLabel["The"] = guiCreateLabel(37, 1, 207, 15, "The city when you can found Jobs and CnR", false, registerWindow["mainWindow"]) 
  
        registerLabel["SF"] = guiCreateLabel(34, 436, 19, 18, "SF", false, registerWindow["mainWindow"]) 
        guiSetFont(registerLabel["SF"], "default-bold-small") 
        registerCheckbox["SF"] = guiCreateCheckBox(14, 436, 16, 18, "", false, false, registerWindow["mainWindow"]) 
        registerLabel[": The"] = guiCreateLabel(55, 413, 305, 18, ": The city where you can found CnR and Some jobs.", false, registerWindow["mainWindow"]) 
        registerLabel[":The"] = guiCreateLabel(55, 441, 305, 18, ":The city where you can found jobs and Some factories", false, registerWindow["mainWindow"]) 
        register.combobox["Choose Skin"] = guiCreateComboBox(92, 467, 167, 23, "", false, registerWindow["mainWindow"]) 
        register.Label["Choose Skin"] = guiCreateLabel(10, 466, 72, 24, "Choose Skin :", false, registerWindow["mainWindow"]) 
        guiSetFont(,register.Label["Choose Skin"] "default-bold-small") 
        registerButton["Main"] = guiCreateButton(9, 553, 171, 23, "Register", false, registerWindow["mainWindow"]) 
        guiSetFont(registerButton["Main"] , "sans") 
        registerButton["Close"] = guiCreateButton(201, 553, 171, 23, "Exit", false, registerWindow["mainWindow"])   
        guiSetFont(registerButton["Close"] , "sans") 
         
        guiEditSetMasked(registerEdit["Password"], true) 
        guiEditSetMasked(loginEdit["Password"], true)        
    end 
) 
addEventHandler("onClientRender", root, 
    function() 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
    end 
) 
  
addEventHandler("onClientRender", root, 
    function() 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(490, 203, 0, 0, ":Godmother/images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
    end 
) 
     
function clientLogin(button, state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(loginEdit["Username"]) 
        local password = guiGetText(loginEdit["Password"]) 
        if username and password then 
            triggerServerEvent("Login",localPlayer, username, password) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", loginButton["Main"], clientLogin, false) 
  
function clientRegister(button, state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(registerEdit["Username"]) 
        local password = guiGetText(registerEdit["Password"]) 
        if username and password then 
            triggerServerEvent("Register",localPlayer, username, password) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", registerButton["Main"], clientRegister, false) 
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible(loginWindow["mainWindow"], false) 
    showCursor(false) 
end 
  
function showRegisterWindow() 
    guiSetInputEnabled( true ) 
    guiSetVisible(registerWindow["mainWindow"], true) 
    showCursor(true) 
    guiSetVisible(loginWindow["mainWindow"], false) 
end 
addEventHandler("onClientGUIClick", mainButton["ClickHere"], showRegisterWindow, false) 
  
function hideRegisterWindow1() 
    guiSetInputEnabled( true ) 
    guiSetVisible(registerWindow["mainWindow"], false) 
    showCursor(true) 
    guiSetVisible(loginWindow["mainWindow"], true) 
end 
addEventHandler("onClientGUIClick",registerButton["Close"], hideRegisterWindow1, false) 
  
  
function hideRegisterWindow() 
    guiSetInputEnabled( false ) 
    guiSetVisible(registerWindow["mainWindow"], false) 
    showCursor(false) 
end 
  
  
  
addEvent("hideRegisterWindow", true) 
addEvent("hideLoginWindow", true) 
addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) 
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) 

plz help me what s wrong

Link to comment
addEvent("Login", true) 
addEvent("Register", true) 
  
function loginHandler(username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        logIn(source, account, password)  
        triggerClientEvent (source, "hideLoginWindow", source) 
    end 
end 
addEventHandler("Login", root, loginHandler) 
  
function registerHandler(username, password) 
    local account = getAccount(username, password) 
    if (account = false) then 
        addAccount(username,password) 
        triggerClientEvent(source, "hideRegisterWindow", getRootElement()) 
    else 
        outputChatBox("This account is already created",source) 
    end 
end 
addEventHandler("Register", root, registerHandler) 

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