Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.24 KB | None | 0 0
  1. GUIEditor = {
  2. tab = {},
  3. staticimage = {},
  4. tabpanel = {},
  5. edit = {},
  6. button = {},
  7. label = {},
  8. checkbox = {},
  9. combobox = {}
  10. }
  11. GUIEditor.tabpanel[1] = guiCreateTabPanel(349, 162, 807, 442, false)
  12.  
  13. GUIEditor.tab[1] = guiCreateTab("Login", GUIEditor.tabpanel[1])
  14.  
  15. GUIEditor.checkbox[1] = guiCreateCheckBox(300, 57, 146, 15, "Remember username ?", true, false, GUIEditor.tab[1])
  16. guiSetProperty(GUIEditor.checkbox[1], "NormalTextColour", "FFB10216")
  17. GUIEditor.checkbox[2] = guiCreateCheckBox(300, 178, 146, 15, "Remember password ?", true, false, GUIEditor.tab[1])
  18. guiSetProperty(GUIEditor.checkbox[2], "NormalTextColour", "FFB10216")
  19. GUIEditor.edit[1] = guiCreateEdit(27, 32, 240, 40, "", false, GUIEditor.tab[1])
  20. GUIEditor.edit[2] = guiCreateEdit(26, 157, 240, 43, "", false, GUIEditor.tab[1])
  21. guiEditSetMasked(GUIEditor.edit[2],true)
  22. GUIEditor.button[1] = guiCreateButton(280, 346, 192, 44, "Login", false, GUIEditor.tab[1])
  23. GUIEditor.button[2] = guiCreateButton(527, 166, 228, 49, "Forgot password ?", false, GUIEditor.tab[1])
  24. GUIEditor.button[3] = guiCreateButton(527, 34, 228, 49, "Forgot username ?", false, GUIEditor.tab[1])
  25. GUIEditor.button[4] = guiCreateButton(147, 268, 465, 57, " ACCOUNT RETRIEVAL", false, GUIEditor.tab[1])
  26. guiSetFont(GUIEditor.button[4], "clear-normal")
  27.  
  28. GUIEditor.tab[2] = guiCreateTab("Register", GUIEditor.tabpanel[1])
  29.  
  30. GUIEditor.edit[3] = guiCreateEdit(37, 27, 231, 38, "", false, GUIEditor.tab[2])
  31. GUIEditor.label[1] = guiCreateLabel(275, 41, 164, 41, "Username", false, GUIEditor.tab[2])
  32. guiSetFont(GUIEditor.label[1], "clear-normal")
  33. GUIEditor.edit[4] = guiCreateEdit(39, 94, 230, 39, "", false, GUIEditor.tab[2])
  34. getEditSetMasked(GUIEditor.edit[4],true)
  35. GUIEditor.label[2] = guiCreateLabel(278, 104, 81, 15, "Password", false, GUIEditor.tab[2])
  36. guiSetFont(GUIEditor.label[2], "clear-normal")
  37. GUIEditor.combobox[1] = guiCreateComboBox(80, 179, 123, 79, "", false, GUIEditor.tab[2])
  38. guiComboBoxAddItem(GUIEditor.combobox[1], "Male")
  39. guiComboBoxAddItem(GUIEditor.combobox[1], "Female")
  40. GUIEditor.label[3] = guiCreateLabel(275, 177, 99, 27, "Gender", false, GUIEditor.tab[2])
  41. GUIEditor.checkbox[3] = guiCreateCheckBox(52, 221, 265, 54, "I agree to follow CRP rules.", false, false, GUIEditor.tab[2])
  42. GUIEditor.button[5] = guiCreateButton(276, 322, 239, 49, "Register", false, GUIEditor.tab[2])
  43. GUIEditor.combobox[2] = guiCreateComboBox(511, 50, 215, 110, "", false, GUIEditor.tab[2])
  44. guiComboBoxAddItem(GUIEditor.combobox[2], "Your childhood name?")
  45. guiComboBoxAddItem(GUIEditor.combobox[2], "Your Mother's last name?")
  46. guiComboBoxAddItem(GUIEditor.combobox[2], "Your highschool?")
  47. guiComboBoxAddItem(GUIEditor.combobox[2], "The city you were born in ?")
  48. guiComboBoxAddItem(GUIEditor.combobox[2], "Your favourite color?")
  49. guiComboBoxAddItem(GUIEditor.combobox[2], "Your favourite sport-team?")
  50.  
  51. GUIEditor.label[4] = guiCreateLabel(0, -23, 245, 24, "", false, GUIEditor.combobox[2])
  52.  
  53. GUIEditor.label[5] = guiCreateLabel(510, 22, 237, 19, "Choose a secret question.", false, GUIEditor.tab[2])
  54. GUIEditor.label[6] = guiCreateLabel(510, 99, 237, 19, "Set your answer.", false, GUIEditor.tab[2])
  55. GUIEditor.edit[5] = guiCreateEdit(510, 122, 252, 35, "", false, GUIEditor.tab[2])
  56. GUIEditor.edit[6] = guiCreateEdit(510, 228, 252, 35, "", false, GUIEditor.tab[2])
  57. GUIEditor.label[7] = guiCreateLabel(510, 202, 237, 19, "Email", false, GUIEditor.tab[2])
  58.  
  59. GUIEditor.tab[3] = guiCreateTab("Rules", GUIEditor.tabpanel[1])
  60. GUIEditor.tab[4] = guiCreateTab("Updates", GUIEditor.tabpanel[1])
  61. GUIEditor.tab[5] = guiCreateTab("Info", GUIEditor.tabpanel[1])
  62.  
  63.  
  64.  
  65. addEvent("showHide",true)
  66. function showHide()
  67. if guiGetVisible(GUIEditor.tab[1]) == true then
  68. guiSetVisible(GUIEditor.tab[1],false)
  69. showCursor(false)
  70. elseif
  71. guiGetVisible(GUIEditor.tab[1]) == false then
  72. guiSetVisible(GUIEditor.tab[1],true)
  73. showCursor(true)
  74. end
  75. end
  76. addEventHandler("showHide", getLocalPlayer(),showHide)
  77.  
  78. showHide()
  79.  
  80. addEventHandler( 'onClientGUIClick', root,
  81. function ()
  82. if (source == GUIEditor.button[1]) then
  83. guiSetVisible ( GUIEditor.tab[1], false)
  84. showCursor(false)
  85. end
  86. end
  87.  
  88. function onRegisterClick ( )
  89. local username = guiGetText (GUIEditor.edit[3])
  90. local password = guiGetText (GUIEditor.edit[4])
  91. if username ~= "" and password ~= "" then
  92. triggerServerEvent("tregister", getLocalPlayer(),username,password)
  93. end
  94. end
  95. addEventHandler("onClientGUIClick",GUIEditor.button[5],onRegisterClick,false)
  96.  
  97.  
  98. function onLoginClick ( )
  99. local username = guiGetText (GUIEditor.edit[1])
  100. local password = guiGetText (GUIEditor.edit[2])
  101. if username ~= "" and password ~= "" then
  102. triggerServerEvent("login",getLocalPlayer(),username,password)
  103. end
  104. end
  105. addEventHandler("onClientGUIClick",GUIEditor.button[5],onLoginClick,false)
  106.  
  107. addEvent("loginn",true)
  108. addEventHandler("loginn",getLocalPlayer(),function()
  109. guiSetVisible(winRegister,false)
  110. showCursor(false)
  111.  
  112. end)
  113.  
  114. addEvent("Login-Register", true)
  115. addEventHandler("Login-Register", root,
  116. function(action, userName, passWord)
  117. if (action == "Login") then
  118. local account = getAccount(userName, passWord)
  119. if account then
  120. logIn(source, account, passWord)
  121. triggerClientEvent(source, "onLoginSuccess", source)
  122. else
  123. exports.UIPtexts:output ("Wrong username or password!", source, 255, 255, 0)
  124. end
  125. elseif (action == "Register") then
  126. local serial = getPlayerSerial(source)
  127. local TotalAcc = TotalAccounts(serial) or 0
  128. if TotalAcc < 3 then
  129. if not getAccount(userName) then
  130. local accountAdded = addAccount(userName, passWord)
  131. if accountAdded then
  132. exports.UIPtexts:output("You have successfully registered!, you can now login with your username and password.", source, 0, 255, 50)
  133. setAccountData(accountAdded, "reg-Serial", serial)
  134. else
  135. exports.UIPtexts:output("Error creating account, please contact the admin.", source, 255, 0, 50)
  136. end
  137. else
  138. exports.UIPtexts:output("Account with this name already exists!", source, 255, 0, 0)
  139. end
  140. else
  141. exports.UIPtexts:output("You can register up to 3 accounts only!", source, 255, 0, 0)
  142. end
  143. end
  144. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement