I learned the basic of lua script, now i'm trying to learn the basic of GUI script, so I started to read at the wiki, I understand almost everything, but i have 2 questions about this GUI script (I copyed the wiki code, but i understood everything), 1 - Why it isn't working? 2 - getResourceRootElement(getThisResource()) <- this! Other thing that I didn't understood is where should I put addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) ?? PS - there is only the GUI, not the scripting of it.
script:
function GUI
local X = 0.375
local Y = 0.375
local altura = 0.50
local largura = 0.25
wdwLogin = guiCreateWindow(X, Y, Width, Height, "TBG - Painel de Login!", true)
X = 0.0825
Y = 0.2
altura = 0.25
largura = 0.25
guiCreateLabel(X, Y, Width, Height, "Login", true, wdwLogin)
Y = 0.5
guiCreateLabel(X, Y, Width, Height, "Senha", true, wdwLogin)
X = 0.415
Y = 0.2
altura = 0.5
largura = 0.15
edtUser = guiCreateEdit(X, Y, Width, Height, "Seu login aqui", true, wdwLogin)
Y = 0.5
edtPass = guiCreateEdit(X, Y, Width, Height, "Sua senha aqui", true, wdwLogin)
guiEditSetMaxLength(edtUser, 15)
guiEditSetMaxLength(edtPass, 20)
X = 0.415
Y = 0.7
Width = 0.25
Height = 0.2
btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)
guiSetVisible(wdwLogin, true)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
createLoginWindow()
outputChatBox("Bem vindo/a ao TBG - RealPlay!")
if (wdwLogin ~= nil) then
guiSetVisible(wdwLogin, true)
else
outputChatBox("Ocorreu um inesperado erro no carregamento no painel de Login, tente reconectar!")
end
showCursor(true)
guiSetInputEnabled(true)
end