Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 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.2
  10. Width = 0.25
  11. Height = 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.5
  20. Height = 0.15
  21. edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
  22. Y = 0.5
  23. edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)
  24. guiEditSetMaxLenght(edtUser, 50)
  25. guiEditSetMaxLenght(edtPass, 50)
  26.  
  27. X = 0.415
  28. Y = 0.7
  29. Width = 0.025
  30. Height = 0.2
  31. btnLogin = guiCreateButton(X, Y, Width, Height, "Log in.", true, wdwLogin)
  32.  
  33. guiSetVisible(wdwLogin, false)
  34. end
  35. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  36. function ()
  37. createLoginWindow()
  38. outputChatBox("Welcome to Fun Flight Server. Please log in.")
  39.  
  40. if (wdwLogin ~= nil) then
  41. guiSetVisible(wdwLogin, true)
  42. else
  43. outputChatBox("An unexpected error has ocurred. Please visit funflightserver.webs.com and report this error.")
  44. end
  45.  
  46. showCursor(true)
  47. guiSetInputEnabled(true)
  48. end
  49. )
  50. addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)
  51.  
  52. function clientSubmitLogin(button,state)
  53. if button == "left" and state == "up" then
  54. local username = guiGetText(edtUser)
  55. local password = guiGetText(edtPass)
  56.  
  57. if username and password then
  58. triggerServerEvent("submitLogin", getRootElement(), username, password)
  59.  
  60. guiSetInputEnabled(false)
  61. guiSetVisible(wdwLogin, false)
  62. showCursor(false)
  63. else
  64. outputChatBox("Please enter wanted username and password.")
  65. end
  66. end
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement