Guest User

register_c.lua

a guest
May 10th, 2015
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.07 KB | None | 0 0
  1.  
  2. GUIEditorr = {
  3.     edit = {},
  4.     button = {},
  5.     window = {},
  6.     label = {},
  7.     radiobutton = {}
  8. }
  9. function openRegisterGUI()
  10.         GUIEditorr.window[1] = guiCreateWindow(326, 85, 417, 275, "", false)
  11.         guiWindowSetSizable(GUIEditorr.window[1], false)
  12.         guiSetAlpha(GUIEditorr.window[1], 1.00)
  13.         GUIEditorr.label[1] = guiCreateLabel(30, 56, 88, 16, "Account Name:", false, GUIEditorr.window[1])
  14.         guiSetFont(GUIEditorr.label[1], "default-bold-small")
  15.         GUIEditorr.label[2] = guiCreateLabel(11, 86, 107, 15, "Account Password:", false, GUIEditorr.window[1])
  16.         guiSetFont(GUIEditorr.label[2], "default-bold-small")
  17.         GUIEditorr.edit[1] = guiCreateEdit(118, 52, 114, 25, "", false, GUIEditorr.window[1])
  18.         GUIEditorr.edit[2] = guiCreateEdit(118, 82, 115, 24, "", false, GUIEditorr.window[1])
  19.         GUIEditorr.button[1] = guiCreateButton(53, 232, 137, 30, "Register!", false, GUIEditorr.window[1])
  20.         GUIEditorr.button[2] = guiCreateButton(240, 232, 118, 30, "Back", false, GUIEditorr.window[1])
  21.         GUIEditorr.label[3] = guiCreateLabel(138, 25, 84, 17, "Registration", false, GUIEditorr.window[1])
  22.         guiSetFont(GUIEditorr.label[3], "default-bold-small")
  23.         GUIEditorr.label[4] = guiCreateLabel(11, 116, 105, 15, "Confirm Password:", false, GUIEditorr.window[1])
  24.         guiSetFont(GUIEditorr.label[4], "default-bold-small")
  25.         GUIEditorr.edit[3] = guiCreateEdit(118, 112, 116, 23, "", false, GUIEditorr.window[1])
  26.         GUIEditorr.edit[4] = guiCreateEdit(138, 141, 220, 23, "", false, GUIEditorr.window[1])
  27.         GUIEditorr.label[5] = guiCreateLabel(24, 145, 104, 19, "E-Mail(optional):", false, GUIEditorr.window[1])
  28.         guiSetFont(GUIEditorr.label[5], "default-bold-small")
  29.         GUIEditorr.label[6] = guiCreateLabel(10, 164, 338, 60, "Account name is different from your nick name,remember it!\nThe password should not be shared with anyone for safety!\nE-Mail is optional and is used to recover your password\n if you lose it at any time!", false, GUIEditorr.window[1])
  30.         GUIEditorr.label[7] = guiCreateLabel(230, 21, 187, 110, "You will be prompted to a menu\n to select the city you want to \n spawn in for the first time.\n When you finish registration.", false, GUIEditorr.window[1])
  31.         guiSetFont(GUIEditorr.label[7], "default-bold-small")
  32.         guiSetProperty(GUIEditorr.edit[2], "MaskText", "True")
  33.         guiSetProperty(GUIEditorr.edit[3], "MaskText", "True")     
  34.         guiSetVisible(GUIEditorr.window[1],true)
  35.         showCursor(true)
  36.         guiSetInputEnabled(true)
  37.         addEventHandler("onClientGUIClick",GUIEditorr.button[2],onClickBtnBack)
  38.         addEventHandler("onClientGUIClick",GUIEditorr.button[1],onClickBtnReg)
  39. end
  40. addEvent("openRegistration",true)
  41. addEventHandler("openRegistration",getRootElement(),openRegisterGUI)
  42.  
  43. function onClickBtnReg(button,state)
  44. if (button == "left" and state == "up") then
  45.     if (source == GUIEditorr.button[1]) then
  46.      username = guiGetText(GUIEditorr.edit[1])
  47.      password = guiGetText(GUIEditorr.edit[2])
  48.      passwordConfirm = guiGetText(GUIEditorr.edit[3])
  49.      triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
  50.      --triggerServerEvent("submitLogin",getLocalPlayer(),username,password)
  51. end
  52. end
  53. end
  54. function reg1(button,state)
  55.      guiSetInputEnabled(false)
  56.      guiSetVisible(GUIEditorr.window[1],false)
  57.      showCursor(false)
  58.      destroyElement(GUIEditorr.window[1])
  59.   end
  60. addEvent("closeRegg",true)
  61. addEventHandler("closeRegg",getRootElement(),reg1)
  62. function reg2(button,state)
  63. if (button == "left" and state == "up") then
  64.    if (source == GUIEditorr.button[1]) then
  65.     guiSetInputEnabled(false)
  66.     guiSetVisible(GUIEditorr.window[1], true)
  67.     showCursor(true)
  68. end
  69. end
  70. end
  71. addEvent("closeReg",true)
  72. addEventHandler("closeReg",getRootElement(),reg2)
  73. function onClickBtnBack(button,state)
  74. if (button == "left" and state == "up") then
  75.    if (source == GUIEditorr.button[2]) then
  76.        triggerServerEvent("openClienty",getLocalPlayer())
  77.        guiSetInputEnabled(true)
  78.        guiSetVisible(GUIEditorr.window[1],false)
  79.     end
  80.   end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment