Hi, I'm new to lua and scripting itself.
I'm trying to make a simple login panel. Almost everything works right, except this one thing:
serverside:
function loginHandler ( usernamelogin, passwordlogin )
local accountlogin = getAccount ( usernamelogin, passwordlogin )
if ( accountlogin ~= false ) then
logIn ( client, accountlogin, passwordlogin )
fadeCamera(client, false, 1.5)
setTimer(fadeCameraDelay,1500,1,client)
else
outputChatBox ( "Wrong username or password!", client, 255, 255, 0 ) -- the login failed
end
end
addEvent("submitLogin",true)
addEventHandler("submitLogin",root,loginHandler)
clientside:
function clientSubmitLogin(button,state)
if button == "left" and state == "up" then
local usernamelogin = guiGetText(UserLogin)
local passwordlogin = guiGetText(PassLogin)
triggerServerEvent("submitLogin", getRootElement(), usernamelogin, passwordlogin)
guiSetInputEnabled(false) -- should not happen if login failed
guiSetVisible(LoginPanel, false) -- should not happen if login failed
showCursor(false) -- should not happen if login failed
stopSound(loginpanelsong) -- should not happen if login failed
end
end
This is for the login button, but I don't know how to make some of the functions (the ones I put comments on) not happen when the login fails.
I tried working around it but still couldn't figure it out and I kept looking on the wiki but couldn't find a way to do it.
Any help is appreciated