Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.44 KB | None | 0 0
  1. local screenWidth, screenHeight = guiGetScreenSize()
  2. local registerpanel = 0
  3.  
  4. function centerGUI ( guiElement )
  5. local width, height = guiGetSize ( guiElement, false )
  6. local x, y = ( sx / 2 - width / 2 ), ( sy / 2 - height / 2 )
  7. guiSetPosition ( guiElement, x, y, false )
  8. end
  9.  
  10. GUIEditor = {
  11. tab = {},
  12. staticimage = {},
  13. tabpanel = {},
  14. edit = {},
  15. button = {},
  16. window = {},
  17. label = {}
  18. }
  19.  
  20.  
  21.  
  22. local screenW, screenH = guiGetScreenSize()
  23.  
  24. function loginrajz()
  25. feledittext = guiGetText (feledit)
  26. jeledittext = guiGetText (jeledit)
  27. dxDrawRectangle((screenW - 243) / 2, (screenH - 353) / 2, 243, 353, tocolor(0, 0, 0, 110), false)
  28. dxDrawRectangle(562, 208, 243, 17, tocolor(0, 0, 0, 110), false)
  29. dxDrawRectangle(574, 259, 221, 30, tocolor(0, 0, 0, 130), false)
  30. dxDrawRectangle(574, 311, 221, 30, tocolor(0, 0, 0, 130), false)
  31. dxDrawRectangle(574, 385, 221, 30, (isCursorInPosition(574, 385, 221, 30) and tocolor(66, 134, 244, 130) or tocolor(0, 0, 0, 130)))
  32. dxDrawRectangle(574, 429, 221, 30, (isCursorInPosition(574, 429, 221, 30) and tocolor(244, 65, 65, 130) or tocolor(0, 0, 0, 130)))
  33. dxDrawText("Üdv az #4286f4Immortal Gaming #ffffffszerverén!\nKérlek #ff6363 regisztrálj #ffffff vagy #4286f4jelentkezz be!\n\n#ffffffTovábbi jó játékot kívánunk!", 576, 481, 795, 533, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  34. dxDrawRectangle(438, 451, 0, 0, tocolor(255, 255, 255, 255), false)
  35. dxDrawText("Jelszó", 620, 292, 746, 311, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  36. dxDrawText("#4286f4Bejelentkezés", 562, 208, 805, 224, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  37. dxDrawText("Felhasználónév", 620, 240, 746, 259, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  38. dxDrawText("Bejelentkezés", 620, 390, 746, 409, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  39. dxDrawText("Regisztráció", 620, 435, 746, 454, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
  40. dxDrawText(feledittext, 578, 259, 799, 288, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center", false, false, false, false, false)
  41. dxDrawText(jeledittext, 578, 365, 799, 288, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center", false, false, false, false, false)
  42. showPlayerHudComponentVisible("all", false)
  43. end
  44.  
  45. function editboxok(source)
  46. feledit = guiCreateEdit( 0.42, 0.34, 0.16, 0.033, "", true) --Felh. írás mező
  47. guiEditSetMaxLength ( feledit, 27 )
  48. guiSetAlpha(feledit, 0)
  49. addEvent ( "onClientRender", true )
  50. addEventHandler("onClientRender", root, loginrajz)
  51. myFont = guiCreateFont( "tahomabd.ttf", 8 )
  52. guiSetFont( feledit, myFont )
  53. jeledit = guiCreateEdit( 0.42, 0.408, 0.16, 0.033, "Jelszó", true) --Felh. írás mező
  54. guiEditSetMaxLength ( jeledit, 27 )
  55. guiSetAlpha(jeledit, 0)
  56. guiSetFont( jeledit, myFont )
  57. setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) -- Set the coordinates of the camera
  58. setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 )
  59. setCameraMode ( source, "fixed" )
  60. end
  61. addEventHandler("onClientResourceStart", getRootElement(), editboxok)
  62.  
  63.  
  64. function isCursorInPosition(rectX, rectY, rectW, rectH)
  65. local cursorX, cursorY = getCursorPosition()
  66. cursorX, cursorY = cursorX * screenWidth, cursorY * screenHeight
  67. return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH)
  68. end
  69.  
  70. function isCursorWithin(x, y, width, height)
  71. if(not isCursorShowing()) then
  72. return false;
  73. end
  74. local sx, sy = guiGetScreenSize();
  75. local cx, cy = getCursorPosition();
  76. local cx, cy = (cx*sx), (cy*sy);
  77. if(cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then
  78. return true;
  79. else
  80. return false;
  81. end
  82. end
  83.  
  84.  
  85. addEvent("showHide",true)
  86. function showHide()
  87. if guiGetVisible(GUIEditor.window[1]) == true then
  88. guiSetVisible(GUIEditor.window[1],false)
  89. showCursor(false)
  90. elseif guiGetVisible(GUIEditor.window[1]) == false then
  91. guiSetVisible(GUIEditor.window[1],true)
  92. showCursor(true)
  93. end
  94. end
  95. addEventHandler("showHide",getLocalPlayer(),showHide)
  96.  
  97. showHide()
  98.  
  99. function buttonClick()
  100. if source == GUIEditor.button[2] then
  101. local username = guiGetText(GUIEditor.edit[4])
  102. local password = guiGetText(GUIEditor.edit[5])
  103. local email = guiGetText(GUIEditor.edit[6])
  104. triggerServerEvent("registerRequest",getLocalPlayer(),getLocalPlayer(),username,password,email)
  105. elseif source == GUIEditor.button[1] then
  106. local username = guiGetText(GUIEditor.edit[1])
  107. local password = guiGetText(GUIEditor.edit[2])
  108. triggerServerEvent("loginRequest",getLocalPlayer(),getLocalPlayer(),username,password)
  109. end
  110. end
  111. addEventHandler("onClientGUIClick",GUIEditor.window[1],buttonClick)
  112.  
  113. function dobozbaVan(dX, dY, dSZ, dM, eX, eY)
  114. if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then
  115. return true
  116. else
  117. return false
  118. end
  119. end
  120.  
  121. function loginBoxClick(button, state, x, y, wx, wy, wz, element)
  122. if (state == "down") then
  123. if dobozbaVan(574, 385, 221, 30, x, y) then
  124. local username = feledittext
  125. local password = jeledittext
  126. triggerServerEvent("loginRequest",getLocalPlayer(),getLocalPlayer(),username,password)
  127. end
  128. if dobozbaVan(574, 429, 221, 30, x, y) then
  129. addEventHandler("onClientRender", root, register)
  130. removeEventHandler("onClientRender", root, loginrajz)
  131. removeEventHandler("onClientResourceStart", getRootElement(), editboxok)
  132. addEventHandler("onClientResourceStart", getRootElement(), login)
  133. end
  134. end
  135. end
  136. addEventHandler("onClientClick", getRootElement(), loginBoxClick)
  137.  
  138. function register()
  139. dxDrawRectangle((screenW - 244) / 2, (screenH - 354) / 2, 244, 321, tocolor(0, 0, 0, 110), false)
  140. dxDrawRectangle(562, 208, 243, 17, tocolor(0, 0, 0, 110), false)
  141. dxDrawRectangle(574, 259, 221, 30, tocolor(0, 0, 0, 130), false)
  142. dxDrawRectangle(574, 309, 221, 30, tocolor(0, 0, 0, 130), false)
  143. dxDrawRectangle(574, 363, 221, 30, tocolor(0, 0, 0, 130), false)
  144. dxDrawText("#4286f4Regisztráció", 561, 208, 805, 225, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  145. dxDrawText("Felhasználónév", 561, 242, 805, 259, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  146. dxDrawText("E-mail", 561, 292, 805, 309, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  147. dxDrawText("Jelszó", 562, 346, 806, 363, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  148. dxDrawRectangle(574, 432, 221, 30, (isCursorInPosition(574, 432, 221, 30) and tocolor(66, 134, 244, 130) or tocolor(0, 0, 0, 130)))
  149. dxDrawText("Regisztráció", 574, 432, 795, 462, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  150. dxDrawText("A regisztrációval automatikusan\n#ff6363elfogadod #ffffff a szerver szabályzatát!", 574, 472, 795, 502, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, true, false)
  151. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement