Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.62 KB | None | 0 0
  1. function createLoginWindow()
  2. local X = 0.375
  3. local Y = 0.375
  4. local Width = 0.25
  5. local Height = 0.25
  6. wdwLogin = guiCreateWindow(X, Y, WIdth, Height, "Please Log In", true)
  7.  
  8. X = 0.0825
  9. Y = 0.25
  10. Width = 0.25
  11. Length = 0.25
  12. guiCreateLabel (X, Y, Width, Height, "Username", true, wdwLogin)
  13. Y = 0.5
  14. guiCreateLabel (X, Y, Width, Height, "Password", true, wdwLogin)
  15.  
  16.  
  17. X = 0.415
  18. Y= 0.2
  19. Width = 0.2
  20. Height = 0.15
  21. X = 0.415
  22. Y=0.2
  23. Width = 0.5
  24. Height = 0.15
  25. edtUser = guiCreateEdit(X, Y, Width, Height, "...", true, wdwLogin)
  26. Y = 0.5
  27. edtPass = guiCreateEdit(X, Y, Width, Height, "....", true, wdwLogin)
  28. guiEditSetMaxLength(edtUser, 50)
  29. guiEditSetMaxLength(edtPass, 50)
  30.  
  31. X = 0.415
  32. Y = 0.7
  33. Width = 0.25
  34. Height = 0.2
  35. btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin)
  36. guiSetVisible(wdwLogin, false)
  37. addEventHandler("onPlayerJoin", getResourceRootElement (),
  38.        function ()
  39.         createLoginWindow()
  40.         outputChatBox("Welcome to My MTA:SA Server, Please log in")
  41.         if (wdwLogin ~= nil) then
  42.           guiSetVisible(wdwLogin, true)
  43.         else
  44.           outputChatBox("An unxpected error has occurred and the log in GUI has not been Created.")
  45.         end
  46.        
  47.         showCursor(true)
  48.         guiSetInputEnabled(true)
  49.         end
  50.         )
  51.         addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)
  52.  
  53. function clientSubmitLogin(button,state)
  54.   if button == "left" and state == "up" then
  55.     guiSetUpEnabled(false)
  56.     guiSetVisible(wdwLogin, false)
  57.     showCursor(false)
  58.   else
  59.     outputChatBox("Please enter a username and password.")
  60.   end
  61. end
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement