Jump to content

the login panel does not display


Wiseguy

Recommended Posts

Hi, I have a problem with my login panel, it does not display correctly. I would like to get help from you. There are no errors in the console.
 

Client:

 
local screenW, screenH = guiGetScreenSize()
windowStart = guiCreateWindow((screenW - 419) / 2, (screenH - 198) / 2, 419, 198, "Panel login v0.1", false)
guiWindowSetSizable(windowStart, false)
guiSetAlpha(windowStart, 0.57)
 
buttonRegister = guiCreateButton(10, 173, 184, 15, "Zarejestruj", false, windowStart)
guiSetProperty(buttonRegister, "NormalTextColour", "FFFEFEFE")
buttonLogin = guiCreateButton(227, 173, 182, 15, "Zaloguj", false, windowStart)
guiSetProperty(buttonLogin, "NormalTextColour", "FFFFFFFF")
editDown = guiCreateEdit(66, 104, 284, 24, "", false, windowStart)
editUp = guiCreateEdit(66, 61, 284, 24, "", false, windowStart)
 
addEvent("showHide", true)
function showHide()
if guiGetVisible(windowStart) == true then
guiSetVisible(windowStart, false)
showCursor(false)
elseif guiGetVisible(windowStart) == false then
guiSetVisible(windowStart, true)
showCursor(true)
end
end
addEventHandler("showHide", getLocalPlayer(), showHide)
 
showHide()
 
function buttonClick()
if source == buttonRegister then
local username = guiGetText(editUp)
local password = guiGetText(editDown)
triggerServerEvent("registerRequest", getLocalPlayer(), getLocalPlayer(), username, password)
elseif source == buttonLogin then
 
end
end
addEventHandler("onClientGUIClick", windowStart, buttonClick)

Server:

addEvent("registerRequest", true)
function registerRequest(player, username, password)
    local account = getAccount(username)
    if account == false then
        local ip = getPlayerIP(player)
        local serial = getPlayerSerial(player)
        exports.mysql:_Exec("insert into users (username, password, ip, serial) values (?,?,?,?)", username, password, ip, serial)
        local addAccounts = addAccount(tostring(username), tostring(password))
        if addAccounts then
            outputDebugString("Użytkownik zarejestrował się z loginem".. username)
        else
            outputDebugString("ERROR: Nie udało się zarejestrować")
        end
    end
end
addEventHandler("registerRequest", getRootElement(), registerRequest)
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...