Advertisement
Guest User

accountC.lua

a guest
Nov 5th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.12 KB | None | 0 0
  1. -- \\ writed by Jack // --
  2. --Regisztráció
  3. --Bejelentkezés
  4. --Karakter létrehozás random név táblából
  5. --Adatok mentése
  6. --Ellenőrizni hogy a játékosnak van -e accountja, ha van akkor a login-t tesszük elé
  7.  
  8.  
  9. local sx, sy = guiGetScreenSize();
  10.  
  11. ---------------------------------------------------------------------------------
  12. --------------------------Mátrixok meghatározása---------------------------------
  13.  
  14. camPos = {}
  15. camPos[1] = {2422.8366699219, -1659.5369873047, 20.660020828247, 2322.8374023438, -1659.1408691406, 20.660020828247}
  16. camPos[2] = {2266.4499511719, -1658.240234375, 21.822526931763, 2166.4719238281, -1656.5705566406, 19.057621002197}
  17. camPos[3] = {2266.4499511719, -1658.240234375, 21.822526931763, 2168.8793945313, -1636.3687744141, 19.057621002197}
  18. camPos[4] = {2113.0180664063, -1613.2703857422, 17.964408874512, 2013.0187988281, -1612.8742675781, 19.057621002197}
  19. camPos[5] = {2009.427734375, -1613.8239746094, 18.143964767456, 1910.4256591797, -1627.3883056641, 19.057621002197}
  20. camPos[6] = {2001.4849853516, -1613.5836181641, 18.143964767456, 2000.6928710938, -1713.5723876953, 19.057621002197}
  21. camPos[7] = {2001.1732177734, -1750.5603027344, 17.712144851685, 2000.3811035156, -1850.5571289063, 19.057621002197}
  22. camPos[8] = {2001.1729736328, -1752.060546875, 17.712144851685, 1901.1818847656, -1751.6645507813, 19.057621002197}
  23. camPos[9] = {1817.8791503906, -1751.7553710938, 18.015951156616, 1717.8798828125, -1751.3592529297, 19.057621002197}
  24. camPos[10] = {1821.6284179688, -1751.6922607422, 18.015951156616, 1820.3547363281, -1651.7084960938, 19.057621002197}
  25. camPos[11] = {1824.8376464844, -1732.0211181641, 18.015951156616, 1724.8383789063, -1731.625, 19.057621002197}
  26. camPos[12] = {1312.8140869141, -1731.5557861328, 18.691499710083, 1212.8280029297, -1729.8859863281, 19.057621002197}
  27. camPos[13] = {1312.8140869141, -1731.5557861328, 18.691499710083, 1312.8140869141, -1631.5638427734, 19.057621002197}
  28. camPos[14] = {1314.7663574219, -1547.4327392578, 19.046047210693, 1321.1307373047, -1447.6435546875, 19.057621002197}
  29. camPos[15] = {1342.5394287109, -1488.2711181641, 19.456857681274, 1377.4528808594, -1394.5725097656, 19.057621002197}
  30. camPos[16] = {1356.9691162109, -1403.126953125, 19.508377075195, 1356.9691162109, -1303.126953125, 19.057621002197}
  31. camPos[17] = {1357.0478515625, -1395.9272460938, 19.508377075195, 1257.0485839844, -1395.5311279297, 19.057621002197}
  32. camPos[18] = {636.24139404297, -1395.6773681641, 20.915954589844, 537.19915771484, -1409.2471923828, 19.057621002197}
  33. camPos[19] = {628.44250488281, -1395.7573242188, 20.915954589844, 627.65032958984, -1495.7541503906, 19.057621002197}
  34. camPos[20] = {621.24371337891, -1744.6323242188, 19.58584022522, 609.017578125, -1843.8820800781, 19.057621002197}
  35. camPos[21] = {621.24371337891, -1744.6323242188, 19.58584022522, 718.34161376953, -1768.5147705078, 19.057621002197}
  36. camPos[22] = {758.74047851563, -1780.4946289063, 19.952068328857, 856.67993164063, -1800.6499023438, 19.057621002197}
  37. camPos[23] = {758.74047851563, -1780.4946289063, 19.952068328857, 858.54315185547, -1786.7741699219, 19.057621002197}
  38. camPos[24] = {1030.5223388672, -1817.9530029297, 20.883810043335, 1123.7994384766, -1853.9774169922, 19.057621002197}
  39. camPos[25] = {1046.5244140625, -1836.9858398438, 19.816757202148, 1044.4587402344, -1936.9564208984, 19.057621002197}
  40. camPos[26] = {1031.8864746094, -2081.6369628906, 14.958271026611, 1014.6212158203, -2180.1352539063, 19.057621002197}
  41. camPos[27] = {1017.1469726563, -2193.8757324219, 15.141680717468, 1020.1759033203, -2293.8298339844, 19.057621002197}
  42. camPos[28] = {1057.1735839844, -2313.23046875, 15.707840919495, 1112.8751220703, -2396.2807617188, 19.057621002197}
  43. camPos[29] = {1112.9096679688, -2382.6008300781, 15.08243560791, 1190.1669921875, -2445.9782714844, 19.057621002197}
  44. camPos[30] = {1318.5529785156, -2463.2524414063, 12.949135780334, 1418.3409423828, -2461.8957519531, 19.057621002197}
  45. camPos[31] = {1318.5529785156, -2463.2524414063, 12.949135780334, 1322.6807861328, -2363.4106445313, 19.057621002197}
  46. camPos[32] = {1323.6564941406, -2392.6127929688, 17.899843215942, 1345.4444580078, -2295.0234375, 19.057621002197}
  47. camPos[33] = {1583.9509277344, -2195.5190429688, 19.057621002197, 1683.9509277344, -2195.4333496094, 19.057621002197}
  48. camPos[34] = {1952.4744873047, -2167.76171875, 19.652322769165, 2052.4396972656, -2165.1286621094, 19.057621002197}
  49. camPos[35] = {1961.4730224609, -2167.7023925781, 19.652322769165, 1961.7834472656, -2067.7028808594, 19.057621002197}
  50. camPos[36] = {1962.5642089844, -1817.1022949219, 19.652322769165, 1962.8746337891, -1717.1027832031, 19.057621002197}
  51. camPos[37] = {1962.4359130859, -1812.1551513672, 19.652322769165, 2062.4357910156, -1812.0695800781, 19.057621002197}
  52. camPos[38] = {2077.0358886719, -1812.0567626953, 19.652322769165, 2177.0358886719, -1811.9711914063, 19.057621002197}
  53. camPos[39] = {2080.5529785156, -1812.82421875, 19.652322769165, 2101.0910644531, -1714.9891357422, 19.057621002197}
  54. camPos[40] = {2093.2312011719, -1756.7137451172, 18.675369262695, 2118.7338867188, -1660.0203857422, 19.057621002197}
  55. camPos[41] = {2093.2600097656, -1754.3140869141, 18.675369262695, 2193.251953125, -1754.228515625, 19.057621002197}
  56. camPos[42] = {2415.3725585938, -1750.5134277344, 18.949174880981, 2515.2961425781, -1746.6072998047, 19.057621002197}
  57. camPos[43] = {2415.3725585938, -1750.5134277344, 18.949174880981, 2413.1362304688, -1650.5709228516, 19.057621002197}
  58. camPos[44] = {2415.0632324219, -1732.3741455078, 18.444812774658, 2515.0480957031, -1733.5622558594, 19.057621002197}
  59. camPos[45] = {2478.0646972656, -1730.8605957031, 18.248012542725, 2578.0473632813, -1729.5013427734, 19.057621002197}
  60. camPos[46] = {2479.2607421875, -1730.9559326172, 18.248012542725, 2487.2053222656, -1631.2801513672, 19.057621002197}
  61. camPos[47] = {2482.8950195313, -1658.1937255859, 19.176633834839, 2476.8403320313, -1558.3852539063, 19.057621002197}
  62. camPos[48] = {2423.3500976563, -1659.0334472656, 20.690965652466, 2323.3696289063, -1657.0532226563, 19.057621002197}
  63.  
  64. ---------------------------------------------------------------------------------
  65. ---------------------------------------------------------------------------------
  66.  
  67. camPos.curr = 1
  68.  
  69.  
  70. camPos.next = ( (camPos.curr >= #camPos) and 1 or (camPos.curr+1) )
  71.  
  72.  
  73. camPos.start = getTickCount()
  74.  
  75. -- Mozgási idő két kameraállás között ezredmásodpercben
  76. camPos.length = 10000
  77.  
  78. -- Render funkció
  79. function moveCamera()
  80.     showChat(false)
  81.     setPlayerHudComponentVisible("all", false)
  82.     fadeCamera(true)
  83.     local tick = getTickCount()
  84.         if (tick - camPos.start) < camPos.length then
  85.             local camX, camY, camZ = interpolateBetween(camPos[camPos.curr][1], camPos[camPos.curr][2], camPos[camPos.curr][3], camPos[camPos.next][1], camPos[camPos.next][2], camPos[camPos.next][3], (tick-camPos.start)/camPos.length, "InOutQuad")
  86.             local lookX, lookY, lookZ = interpolateBetween(camPos[camPos.curr][4], camPos[camPos.curr][5], camPos[camPos.curr][6], camPos[camPos.next][4], camPos[camPos.next][5], camPos[camPos.next][6], (tick-camPos.start)/camPos.length, "InOutQuad")
  87.             setCameraMatrix(camX, camY, camZ, lookX, lookY, lookZ)
  88.         else
  89.             camPos.curr = camPos.next
  90.             camPos.next = ( (camPos.curr >= #camPos) and 1 or (camPos.curr+1) )
  91.             camPos.start = tick
  92.         end
  93. end
  94. addEventHandler("onClientRender", root, moveCamera)
  95.  
  96. ---------------------------------------------------------------------------------
  97. ---------------------------------------------------------------------------------
  98.  
  99. local buttoncolors = {
  100.     [1] = tocolor(0, 140, 229, 150)
  101. }
  102.  
  103. function showRegister()
  104.  
  105.     showCursor(true)
  106.  
  107.     dxDrawRectangle(sx * 0.4068, sy * 0.3083, sx * 0.1865, sy * 0.3833, tocolor(0, 0, 0, 150), false) --háttér   
  108.  
  109.     dxDrawRectangle(sx * 0.4068, sy * 0.3083, sx * 0.1865, sy * 0.0296, tocolor(0, 140, 229, 150), false) --Fejléc
  110.         dxDrawText("Regisztráció", (sx * 0.4646) - 1, (sy * 0.3074) - 1, (sx * 0.5349) - 1, (sy * 0.3380) - 1, tocolor(0, 0, 0, 255), 1.90, "default", "center", "center", false, false, false, false, false) --Fejléc szöveg
  111.         dxDrawText("Regisztráció", (sx * 0.4646) + 1, (sy * 0.3074) - 1, (sx * 0.5349) + 1, (sy * 0.3380) - 1, tocolor(0, 0, 0, 255), 1.90, "default", "center", "center", false, false, false, false, false) --Fejléc szöveg
  112.         dxDrawText("Regisztráció", (sx * 0.4646) - 1, (sy * 0.3074) + 1, (sx * 0.5349) - 1, (sy * 0.3380) + 1, tocolor(0, 0, 0, 255), 1.90, "default", "center", "center", false, false, false, false, false) --Fejléc szöveg
  113.         dxDrawText("Regisztráció", (sx * 0.4646) + 1, (sy * 0.3074) + 1, (sx * 0.5349) + 1, (sy * 0.3380) + 1, tocolor(0, 0, 0, 255), 1.90, "default", "center", "center", false, false, false, false, false) --Fejléc szöveg      
  114.         dxDrawText("Regisztráció", sx * 0.4646, sy * 0.3074, sx * 0.5349, sy * 0.3380, tocolor(255, 255, 255, 255), 1.90, "default", "center", "center", false, false, false, false, false) --Fejléc szöveg    
  115.        
  116.     regbutton = dxDrawRectangle(sx * 0.4120, sy * 0.6583, sx * 0.0688, sy * 0.0241, buttoncolors[1], false) --regisztráció gomb
  117.         if isPlayerCursorInRectangle(sx * 0.4120, sy * 0.6583, sx * 0.0688, sy * 0.0241) then
  118.             dxDrawRectangle(sx * 0.4120, sy * 0.6583, sx * 0.0688, sy * 0.0241, tocolor(0, 140, 229, 255), false)
  119.         else
  120.             dxDrawRectangle(sx * 0.4120, sy * 0.6583, sx * 0.0688, sy * 0.0241, tocolor(0, 140, 229, 150), false)
  121.         end
  122.     addEventHandler("onClientGUIClick", regbutton, isPlayerClickedRegButton, false)
  123.         dxDrawText("Regisztráció", (sx * 0.4120) - 1, (sy * 0.6583) - 1, (sx * 0.4807) - 1, (sy * 0.6833) - 1, tocolor(0, 0, 0, 255), 1.80, "default", "center", "center", false, false, false, false, false) --regisztráció gomb
  124.         dxDrawText("Regisztráció", (sx * 0.4120) + 1, (sy * 0.6583) - 1, (sx * 0.4807) + 1, (sy * 0.6833) - 1, tocolor(0, 0, 0, 255), 1.80, "default", "center", "center", false, false, false, false, false) --regisztráció gomb
  125.         dxDrawText("Regisztráció", (sx * 0.4120) - 1, (sy * 0.6583) + 1, (sx * 0.4807) - 1, (sy * 0.6833) + 1, tocolor(0, 0, 0, 255), 1.80, "default", "center", "center", false, false, false, false, false) --regisztráció gomb
  126.         dxDrawText("Regisztráció", (sx * 0.4120) + 1, (sy * 0.6583) + 1, (sx * 0.4807) + 1, (sy * 0.6833) + 1, tocolor(0, 0, 0, 255), 1.80, "default", "center", "center", false, false, false, false, false) --regisztráció gomb      
  127.         dxDrawText("Regisztráció", sx * 0.4120, sy * 0.6583, sx * 0.4807, sy * 0.6833, tocolor(255, 255, 255, 255), 1.80, "default", "center", "center", false, false, false, false, false) --regisztráció gomb    
  128.        
  129.     dxDrawRectangle(sx * 0.5193, sy * 0.6583, sx * 0.0688, sy * 0.0241, tocolor(0, 140, 229, 150), false) --bejelentkező gomb
  130.         if isPlayerCursorInRectangle(sx * 0.5193, sy * 0.6583, sx * 0.0688, sy * 0.0241) then
  131.             dxDrawRectangle(sx * 0.5193, sy * 0.6583, sx * 0.0688, sy * 0.0241, tocolor(0, 140, 229, 255), false)
  132.         else
  133.             dxDrawRectangle(sx * 0.5193, sy * 0.6583, sx * 0.0688, sy * 0.0241, tocolor(0, 140, 229, 150), false)
  134.         end
  135.         dxDrawText("Bejelentkezés", (sx * 0.5193) - 1, (sy * 0.6574) - 1, (sx * 0.5880) - 1, (sy * 0.6824) - 1, tocolor(0, 0, 0, 255), 1.70, "default", "center", "center", false, false, false, false, false) --bejelentkező gomb
  136.         dxDrawText("Bejelentkezés", (sx * 0.5193) + 1, (sy * 0.6574) - 1, (sx * 0.5880) + 1, (sy * 0.6824) - 1, tocolor(0, 0, 0, 255), 1.70, "default", "center", "center", false, false, false, false, false) --bejelentkező gomb
  137.         dxDrawText("Bejelentkezés", (sx * 0.5193) - 1, (sy * 0.6574) + 1, (sx * 0.5880) - 1, (sy * 0.6824) + 1, tocolor(0, 0, 0, 255), 1.70, "default", "center", "center", false, false, false, false, false) --bejelentkező gomb
  138.         dxDrawText("Bejelentkezés", (sx * 0.5193) + 1, (sy * 0.6574) + 1, (sx * 0.5880) + 1, (sy * 0.6824) + 1, tocolor(0, 0, 0, 255), 1.70, "default", "center", "center", false, false, false, false, false) --bejelentkező gomb
  139.         dxDrawText("Bejelentkezés", sx * 0.5193, sy * 0.6574, sx * 0.5880, sy * 0.6824, tocolor(255, 255, 255, 255), 1.70, "default", "center", "center", false, false, false, false, false) --bejelentkező gomb
  140.            
  141.     dxDrawText("Felhasználónév:", sx * 0.4141, sy * 0.3630, sx * 0.4839, sy * 0.3843, tocolor(255, 255, 255, 255), 1.50, "default", "left", "center", false, false, false, false, false)
  142.     --Felhasználónév mező
  143.  
  144.     dxDrawText("Jelszó:", sx * 0.4141, sy * 0.4306, sx * 0.4427, sy * 0.4519, tocolor(255, 255, 255, 255), 1.50, "default", "left", "center", false, false, false, false, false)
  145.     --Jelszó mező
  146.  
  147.     dxDrawText("Jelszó megerősítése:", sx * 0.4141, sy * 0.4926, sx * 0.5031, sy * 0.5139, tocolor(255, 255, 255, 255), 1.50, "default", "left", "center", false, false, false, false, false)
  148.     --Jelszó megerősítése mező
  149.  
  150.     dxDrawText("E-mail:", sx * 0.4141, sy * 0.5500, sx * 0.4427, sy * 0.5713, tocolor(255, 255, 255, 255), 1.50, "default", "left", "center", false, false, false, false, false)
  151.     --E-mail mező
  152.  
  153. end
  154. addEventHandler("onClientRender", root, showRegister)
  155.  
  156. local username = _username
  157. local password = _password
  158. local passwordconfirm = _passwordconfirm
  159. local email = _email
  160.  
  161. function dataButtons()
  162.  
  163.     username = guiCreateEdit(0.41, 0.39, 0.11, 0.02, "", true) --Felhasználónév mező
  164.  
  165.     password = guiCreateEdit(0.41, 0.46, 0.09, 0.02, "", true) --Jelszó mező
  166.     guiEditSetMasked(password, true)   
  167.  
  168.     passwordconfirm = guiCreateEdit(0.41, 0.52, 0.09, 0.02, "", true) --Jelszó megerősítése mező
  169.     guiEditSetMasked(passwordconfirm, true)
  170.  
  171.     email = guiCreateEdit(0.41, 0.58, 0.09, 0.02, "", true) --E-mail mező
  172.  
  173. end
  174. addEventHandler("onClientResourceStart", root, dataButtons)
  175.  
  176. addEvent("sendDatas:server", true)
  177. addEventHandler("sendDatas:server", root,
  178.     function(_username, _password, _passwordconfirm, _email)
  179.         local _username = guiGetText(_username)
  180.         local _password = guiGetText(_password)
  181.         local _passwordconfirm = guiGetText(_passwordconfirm)
  182.         local _email = guiGetText(_email)
  183.  
  184.     end
  185. )
  186.  
  187. function isPlayerClickedRegButton(button, state)
  188.     if button == "left" then
  189.         triggerServerEvent("acc:Register", root)
  190.     end
  191. end
  192.  
  193. ---------------------------------------------------------------------------------
  194. ---------------------------------------------------------------------------------
  195.  
  196. addEvent("cancelMoveCamera", true)
  197. addEventHandler("cancelMoveCamera", root,
  198.     function()
  199.         showCursor(false)
  200.         showChat(true)
  201.         setPlayerHudComponentVisible("all", true)
  202.         setCameraTarget(localPlayer)
  203.         removeEventHandler("onClientRender", root, moveCamera)
  204.         removeEventHandler("onClientRender", root, showRegister)
  205.         removeEventHandler("onClientResourceStart", root, dataButtons)
  206.     end
  207. )
  208.  
  209. ---------------------------------------------------------------------------------
  210. ---------------------------------------------------------------------------------
  211.  
  212. function isPlayerCursorInRectangle(x, y, w, h)
  213.     if isCursorShowing() then
  214.         local mx, my = getCursorPosition()
  215.         local cursorX, cursorY = mx*sx, my*sy
  216.         if cursorX > x and cursorX < x + w and cursorY > y and cursorY < y + h then
  217.             return true
  218.         else
  219.             return false
  220.         end
  221.     end
  222. end
  223.  
  224. ---------------------------------------------------------------------------------
  225. ---------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement