Advertisement
Guest User

Scripts

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