Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- the meta file:
- <meta>
- <info author="Ahmed" name="login" />
- <script src="login.lua" type="client" />
- </meta>
- the script itself:
- 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.25
- Width = 0.25
- Length = 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.2
- Height = 0.15
- 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, 50)
- guiEditSetMaxLength(edtPass, 50)
- X = 0.415
- Y = 0.7
- Width = 0.25
- Height = 0.2
- btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)
- guiSetVisible(wdwLogin, false)
- addEventHandler("onPlayerJoin", getResourceRootElement (),
- function ()
- createLoginWindow()
- outputChatBox("Welcome to My MTA:SA Server, Please log in")
- if (wdwLogin ~= nil) then
- guiSetVisible(wdwLogin, true)
- else outputChatBox("An unxpected error has occurred and the log in GUI has not been Created.")
- end
- showCursor(true)
- guiSetInputEnabled(true)
- end
- )
- addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)
- function clientSubmitLogin(button,state)
- if button == "left" and state == "up" then
- guiSetUpEnabled(false)
- guiSetVisible(wdwLogin, false)
- showCursor(false)
- else
- outputChatBox("Please enter a username and password.")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement