Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createLoginWindow()
- local X = 0.375
- local Y = 0.375
- local Width = 0.25
- local Height = 0.25
- wdwLogin = guiCreateWindow (X, Y, Width, Height, "Please log in.", true)
- X = 0.0825
- Y = 0.2
- Width = 0.25
- Height = 0.25
- guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin)
- Y = 0.5
- guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin)
- X = 0.415
- Y = 0.2
- Width = 0.5
- Height = 0.15
- edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
- Y = 0.5
- edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
- guiEditSetMaxLenght(edtUser, 50)
- guiEditSetMaxLenght(edtPass, 50)
- X = 0.415
- Y = 0.7
- Width = 0.025
- Height = 0.2
- btnLogin = guiCreateButton(X, Y, Width, Height, "Log in.", true, wdwLogin)
- guiSetVisible(wdwLogin, false)
- end
- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
- function ()
- createLoginWindow()
- outputChatBox("Welcome to Fun Flight Server. Please log in.")
- if (wdwLogin ~= nil) then
- guiSetVisible(wdwLogin, true)
- else
- outputChatBox("An unexpected error has ocurred. Please visit funflightserver.webs.com and report this error.")
- end
- if btnLogin then
- addEventHandler ('onClientGUIClick', btnLogin, clientSubmitLogin, false)
- else
- outputDebugString ('attaching event handler for btnLogin fail')
- end
- showCursor(true)
- guiSetInputEnabled(true)
- end
- )
- function clientSubmitLogin(button,state)
- if button == "left" and state == "up" then
- local username = guiGetText(edtUser)
- local password = guiGetText(edtPass)
- if username and password then
- triggerServerEvent("submitLogin", getRootElement(), username, password)
- guiSetInputEnabled(false)
- guiSetVisible(wdwLogin, false)
- showCursor(false)
- else
- outputChatBox("Please enter wanted username and password.")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement