Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
- function ()
- createLoginWindow()
- guiSetVisible(wdwLogin, true)
- showCursor(true)
- guiSetInputEnabled(true)
- outputChatBox("Welcome to My MTA:SA Server, please log in.")
- fadeCamera(true, 5)
- showPlayerHudComponent("radar", false)
- showPlayerHudComponent("wanted", false)
- showPlayerHudComponent("clock", false)
- showPlayerHudComponent("armour", false)
- showPlayerHudComponent("area_name", false)
- showPlayerHudComponent("ammo", false)
- showPlayerHudComponent("weapon", false)
- setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
- end
- )
- addEvent("loginResponse", true)
- addEventHandler("loginResponse", getRootElement(),
- function (response)
- outputChatBox("("..response..")")
- if response == 1 then
- outputChatBox("Nieprawidlowy nick lub haslo.")
- else
- triggerServerEvent("SetPlayerSpawn", getRootElement())
- end
- end
- )
- addEvent("HideLoginGUI", true)
- addEventHandler("HideLoginGUI", getRootElement(),
- function ()
- guiSetVisible(wdwLogin, false)
- showCursor(false)
- guiSetInputEnabled(false)
- end
- )
- 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)
- guiWindowSetMovable(wdwLogin, false)
- 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)
- guiEditSetMaxLength(edtUser, 32)
- guiEditSetMaxLength(edtPass, 32)
- guiEditSetMasked(edtPass, true)
- X = 0.415
- Y = 0.7
- Width = 0.25
- Height = 0.2
- btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)
- addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)
- 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)
- else
- outputChatBox("Please enter a username and password.")
- end
- end
- end
Add Comment
Please, Sign In to add comment