thenuke321

Untitled

Sep 3rd, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 66.46 KB | None | 0 0
  1. screenWidth, screenHeight = guiGetScreenSize()
  2. responsiveMultipler = 1
  3. function resp(_ARG_0_)
  4.   return _ARG_0_ * responsiveMultipler
  5. end
  6. function respc(_ARG_0_)
  7.   return math.ceil(_ARG_0_ * responsiveMultipler)
  8. end
  9. function reMap(_ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_, _ARG_4_)
  10.   return (_ARG_0_ - _ARG_1_) * (_ARG_4_ - _ARG_3_) / (_ARG_2_ - _ARG_1_) + _ARG_3_
  11. end
  12. fontSizeMultipler = reMap(screenWidth, 1024, 1920, 0.7, 1)
  13. panelState = false
  14. menuWidth = respc(400)
  15. menuHeight = respc(600)
  16. menuPosX = respc(20)
  17. menuPosY = respc(120)
  18. rowHeight = respc(40)
  19. Roboto = false
  20. Roboto2 = false
  21. Roboto3 = false
  22. Roboto4 = false
  23. currentLevel = 1
  24. currentSubLevel = 1
  25. selectionLevel = 0
  26. selectedMenu = 1
  27. buyingInProgress = false
  28. vehicleElement = false
  29. originalUpgrade = 0
  30. neonState = false
  31. neonId = false
  32. originalDoor = false
  33. originalPaintjob = false
  34. originalHeadLight = false
  35. originalHandling = false
  36. editPlate = false
  37. originalPlate = false
  38. vehicleColor = {}
  39. vehicleLightColor = {}
  40. addEventHandler("onClientElementDataChange", getRootElement(), function(_ARG_0_)
  41.   if _ARG_0_ == "vehicle.tuning.Turbo" then
  42.     if isElement(_UPVALUE0_[source]) then
  43.       destroyElement(_UPVALUE0_[source])
  44.     end
  45.     if getElementData(source, "vehicle.tuning.Turbo") == 5 and isElementStreamedIn(source) and _UPVALUE1_[getElementModel(source)] then
  46.       _UPVALUE0_[source] = createObject(2052, 0, 0, 0)
  47.       attachElements(_UPVALUE0_[source], source, unpack(_UPVALUE1_[getElementModel(source)]))
  48.       setElementCollisionsEnabled(_UPVALUE0_[source], false)
  49.       setElementPosition(source, getElementPosition(source))
  50.       setElementPosition(source, getElementPosition(source))
  51.     end
  52.   end
  53. end)
  54. addEventHandler("onClientElementDestroy", getRootElement(), function()
  55.   if isElement(_UPVALUE0_[source]) then
  56.     destroyElement(_UPVALUE0_[source])
  57.   end
  58. end)
  59. addEventHandler("onClientElementStreamOut", getRootElement(), function()
  60.   if isElement(_UPVALUE0_[source]) then
  61.     destroyElement(_UPVALUE0_[source])
  62.   end
  63. end)
  64. addEventHandler("onClientElementStreamIn", getRootElement(), function()
  65.   if isElement(_UPVALUE0_[source]) then
  66.     destroyElement(_UPVALUE0_[source])
  67.   end
  68.   if getElementData(source, "vehicle.tuning.Turbo") == 5 and _UPVALUE1_[getElementModel(source)] then
  69.     _UPVALUE0_[source] = createObject(2052, 0, 0, 0)
  70.     attachElements(_UPVALUE0_[source], source, unpack(_UPVALUE1_[getElementModel(source)]))
  71.     setElementCollisionsEnabled(_UPVALUE0_[source], false)
  72.     setElementPosition(source, getElementPosition(source))
  73.     setElementPosition(source, getElementPosition(source))
  74.   end
  75. end)
  76. addEventHandler("onClientResourceStart", getRootElement(), function(_ARG_0_)
  77.   if getResourceName(_ARG_0_) == "sas_hud" then
  78.     responsiveMultipler = exports.sas_hud:getResponsiveMultipler()
  79.     menuWidth = respc(400)
  80.     menuHeight = respc(600)
  81.     menuPosX = respc(20)
  82.     menuPosY = respc(120)
  83.     rowHeight = respc(40)
  84.   elseif source == getResourceRootElement() then
  85.     if getResourceFromName("sas_hud") and getResourceState((getResourceFromName("sas_hud"))) == "running" then
  86.       responsiveMultipler = exports.sas_hud:getResponsiveMultipler()
  87.       menuWidth = respc(400)
  88.       menuHeight = respc(600)
  89.       menuPosX = respc(20)
  90.       menuPosY = respc(120)
  91.       rowHeight = respc(40)
  92.     end
  93.     engineImportTXD(engineLoadTXD("files/block.txd"), 2052)
  94.     engineReplaceModel(engineLoadDFF("files/block.dff"), 2052)
  95.     for _FORV_7_, _FORV_8_ in pairs(getElementsByType("vehicle", getRootElement(), true)) do
  96.       if getElementData(_FORV_8_, "vehicle.tuning.Turbo") == 5 and _UPVALUE0_[getElementModel(_FORV_8_)] then
  97.         _UPVALUE1_[_FORV_8_] = createObject(2052, 0, 0, 0)
  98.         attachElements(_UPVALUE1_[_FORV_8_], _FORV_8_, unpack(_UPVALUE0_[getElementModel(_FORV_8_)]))
  99.         setElementCollisionsEnabled(_UPVALUE1_[_FORV_8_], false)
  100.         setElementPosition(_FORV_8_, getElementPosition(_FORV_8_))
  101.         setElementPosition(_FORV_8_, getElementPosition(_FORV_8_))
  102.       end
  103.     end
  104.   end
  105. end)
  106. function createFonts()
  107.   destroyFonts()
  108.   Roboto = dxCreateFont("files/fonts/Roboto.ttf", 14 * fontSizeMultipler, false, "antialiased")
  109.   Roboto2 = dxCreateFont("files/fonts/Roboto.ttf", 18 * fontSizeMultipler, false, "antialiased")
  110.   Roboto3 = dxCreateFont("files/fonts/Roboto.ttf", 36 * fontSizeMultipler, false, "antialiased")
  111.   Roboto4 = dxCreateFont("files/fonts/Roboto.ttf", 11 * fontSizeMultipler, false, "antialiased")
  112. end
  113. function destroyFonts()
  114.   if isElement(Roboto) then
  115.     destroyElement(Roboto)
  116.   end
  117.   if isElement(Roboto2) then
  118.     destroyElement(Roboto2)
  119.   end
  120.   if isElement(Roboto3) then
  121.     destroyElement(Roboto3)
  122.   end
  123.   if isElement(Roboto4) then
  124.     destroyElement(Roboto4)
  125.   end
  126. end
  127. addEvent("toggleTuning", true)
  128. addEventHandler("toggleTuning", getRootElement(), function(_ARG_0_, _ARG_1_)
  129.   panelState = _ARG_0_
  130.   showCursor(_ARG_0_)
  131.   camRotation = 0
  132.   camOffsetZ = 0
  133.   _UPVALUE0_ = 1
  134.   if panelState then
  135.     vehicleElement = getPedOccupiedVehicle(localPlayer)
  136.     if not vehicleElement then
  137.       panelState = false
  138.       return
  139.     end
  140.     createFonts()
  141.     vehicleColor = {
  142.       getVehicleColor(vehicleElement, true)
  143.     }
  144.     vehicleLightColor = {
  145.       getVehicleHeadLightColor(vehicleElement)
  146.     }
  147.     exports.sas_hud:hideHUD()
  148.     _UPVALUE1_ = {
  149.       {
  150.         getElementPosition(vehicleElement)
  151.       }[1] + (0 + (5 - 0) * math.cos((math.rad({
  152.         getElementRotation(vehicleElement)
  153.       }[3]))) - (5 - 0) * math.sin((math.rad({
  154.         getElementRotation(vehicleElement)
  155.       }[3])))),
  156.       {
  157.         getElementPosition(vehicleElement)
  158.       }[2] + (0 + (5 - 0) * math.sin((math.rad({
  159.         getElementRotation(vehicleElement)
  160.       }[3]))) + (5 - 0) * math.cos((math.rad({
  161.         getElementRotation(vehicleElement)
  162.       }[3])))),
  163.       {
  164.         getElementPosition(vehicleElement)
  165.       }[3] + 2.5,
  166.       {
  167.         getElementPosition(vehicleElement)
  168.       }[1],
  169.       {
  170.         getElementPosition(vehicleElement)
  171.       }[2],
  172.       {
  173.         getElementPosition(vehicleElement)
  174.       }[3]
  175.     }
  176.     _UPVALUE2_ = _UPVALUE1_
  177.     _UPVALUE3_ = _UPVALUE2_
  178.     _UPVALUE4_ = getElementData(localPlayer, "char.Money") or 0
  179.     _UPVALUE5_ = getElementData(localPlayer, "acc.premiumPoints") or 0
  180.     currentLevel = 1
  181.     currentSubLevel = 1
  182.     selectionLevel = 0
  183.     selectedMenu = 1
  184.   else
  185.     destroyFonts()
  186.     setCameraTarget(localPlayer)
  187.     exports.sas_hud:showHUD()
  188.     colorPicker = false
  189.   end
  190. end)
  191. addEvent("updatePremiumPoints", true)
  192. addEventHandler("updatePremiumPoints", getRootElement(), function(_ARG_0_)
  193.   _UPVALUE0_ = _ARG_0_
  194.   setElementData(localPlayer, "acc.premiumPoints", _ARG_0_)
  195. end)
  196. addEventHandler("onClientElementDataChange", getRootElement(), function(_ARG_0_, _ARG_1_)
  197.   if _ARG_0_ == "char.Money" and source == localPlayer then
  198.     if (getElementData(localPlayer, _ARG_0_) or 0) < _UPVALUE0_ then
  199.       _UPVALUE1_ = _UPVALUE0_ - (getElementData(localPlayer, _ARG_0_) or 0)
  200.       _UPVALUE2_ = getTickCount()
  201.     end
  202.     _UPVALUE0_ = getElementData(localPlayer, _ARG_0_) or 0
  203.   elseif _ARG_0_ == "acc.premiumPoints" and source == localPlayer then
  204.     if (getElementData(localPlayer, _ARG_0_) or 0) < _UPVALUE3_ then
  205.       _UPVALUE4_ = _UPVALUE3_ - (getElementData(localPlayer, _ARG_0_) or 0)
  206.       _UPVALUE5_ = getTickCount()
  207.     end
  208.     _UPVALUE3_ = getElementData(localPlayer, _ARG_0_) or 0
  209.   elseif _ARG_0_ == "loggedIn" and source == localPlayer then
  210.     for _FORV_5_, _FORV_6_ in ipairs(getElementsByType("vehicle")) do
  211.       for _FORV_11_, _FORV_12_ in pairs((split(getElementData(_FORV_6_, "vehicle.tuning.Optical") or "", ","))) do
  212.         addVehicleUpgrade(_FORV_6_, _FORV_12_)
  213.       end
  214.     end
  215.   end
  216. end)
  217. addEventHandler("onResourceStart", getResourceRootElement(), function()
  218.   connection = exports.sas_database:getConnection()
  219. end)
  220. addEventHandler("onClientRender", getRootElement(), function()
  221.   if panelState then
  222.     if selectionLevel == 1 then
  223.     elseif selectionLevel == 2 then
  224.     end
  225.     if selectionLevel == 1 then
  226.     elseif selectionLevel == 2 then
  227.     end
  228.     _UPVALUE0_ = {}
  229.     visibleCount = 0
  230.     notVisibleCount = 0
  231.     smallestVisible = 0
  232.     for _FORV_6_ = 1, #tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu do
  233.       if false then
  234.         _UPVALUE0_[_FORV_6_] = true
  235.         visibleCount = visibleCount + 1
  236.         if smallestVisible == 0 then
  237.           smallestVisible = _FORV_6_
  238.         end
  239.       else
  240.         notVisibleCount = notVisibleCount + 1
  241.       end
  242.     end
  243.     menuHeight = visibleCount * rowHeight
  244.     dxDrawRectangle(0, 0, screenWidth, respc(100), tocolor(0, 0, 0, 160))
  245.     dxDrawImage(respc(20), 0, respc(100), respc(100), "files/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255))
  246.     dxDrawText("#7cc576SeeMTA v3 #ffffff- Tuning", respc(130), respc(20), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto3, "left", "top", false, false, true, true, true)
  247.     if _UPVALUE2_ + 3000 >= getTickCount() then
  248.       dxDrawText("#7cc576K\195\169szp\195\169nz:#ffffff\n" .. thousandsStepper(_UPVALUE3_) .. " #7cc576$\t#d75959(-" .. thousandsStepper(_UPVALUE4_) .. " $)", screenWidth - respc(300), respc(3), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  249.     else
  250.       dxDrawText("#7cc576K\195\169szp\195\169nz:#ffffff\n" .. thousandsStepper(_UPVALUE3_) .. " #7cc576$", screenWidth - respc(300), respc(3), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  251.     end
  252.     if _UPVALUE5_ + 3000 >= getTickCount() then
  253.       dxDrawText("#32b3efPr\195\169mium pont:#ffffff\n" .. thousandsStepper(_UPVALUE6_) .. " #32b3efPP\t#d75959(-" .. thousandsStepper(_UPVALUE7_) .. " PP)", screenWidth - respc(300), respc(50), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  254.     else
  255.       dxDrawText("#32b3efPr\195\169mium pont:#ffffff\n" .. thousandsStepper(_UPVALUE6_) .. " #32b3efPP", screenWidth - respc(300), respc(50), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  256.     end
  257.     dxDrawRectangle(0, screenHeight - respc(80), screenWidth, respc(80), tocolor(0, 0, 0, 160))
  258.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu] then
  259.       if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price then
  260.         if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType == "money" then
  261.           dxDrawText("\195\129r: #7cc576" .. thousandsStepper(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price) .. " $", respc(10), screenHeight - respc(75), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto, "left", "top", false, false, true, true, true)
  262.         elseif tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType == "premium" then
  263.           dxDrawText("\195\129r: #32b3ef" .. thousandsStepper(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price) .. " PP", respc(10), screenHeight - respc(75), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto, "left", "top", false, false, true, true, true)
  264.         elseif tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType == "free" then
  265.           dxDrawText("\195\129r: #d75959Ingyenes", respc(10), screenHeight - respc(75), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto, "left", "top", false, false, true, true, true)
  266.         end
  267.       end
  268.       if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].hint then
  269.         dxDrawText(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].hint, respc(10), screenHeight - respc(75) + respc(25), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  270.       end
  271.     end
  272.     dxDrawImage(screenWidth - respc(582), screenHeight - respc(75), respc(128), respc(32), "files/nav/enter.png")
  273.     dxDrawText("V\195\161s\195\161rl\195\161s", screenWidth - respc(582) + respc(66), screenHeight - respc(75) + respc(5), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  274.     dxDrawImage(screenWidth - respc(582) + respc(130), screenHeight - respc(75), respc(128), respc(32), "files/nav/backspace.png")
  275.     dxDrawText("Kil\195\169p\195\169s", screenWidth - respc(582) + respc(216), screenHeight - respc(75) + respc(5), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  276.     dxDrawImage(screenWidth - respc(582) + respc(268), screenHeight - respc(75), respc(32), respc(32), "files/nav/up.png")
  277.     dxDrawImage(screenWidth - respc(582) + respc(300), screenHeight - respc(75), respc(32), respc(32), "files/nav/down.png")
  278.     dxDrawText("Navig\195\161ci\195\179", screenWidth - respc(582) + respc(336), screenHeight - respc(75) + respc(5), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  279.     dxDrawImage(screenWidth - respc(582) + respc(408), screenHeight - respc(75), respc(32), respc(32), "files/nav/mouse.png")
  280.     dxDrawText("Kamera mozgat\195\161s", screenWidth - respc(582) + respc(442), screenHeight - respc(75) + respc(5), 0, 0, tocolor(255, 255, 255, 255), 1, Roboto4, "left", "top", false, false, true, true, true)
  281.     dxDrawRectangle(menuPosX, menuPosY, menuWidth, menuHeight, tocolor(0, 0, 0, 150))
  282.     dxDrawRectangle(menuPosX, menuPosY, menuWidth, 2, tocolor(0, 0, 0, 200))
  283.     dxDrawRectangle(menuPosX, menuPosY + menuHeight - 2, menuWidth, 2, tocolor(0, 0, 0, 200))
  284.     dxDrawRectangle(menuPosX, menuPosY + 2, 2, menuHeight - 4, tocolor(0, 0, 0, 200))
  285.     dxDrawRectangle(menuPosX + menuWidth - 2, menuPosY + 2, 2, menuHeight - 4, tocolor(0, 0, 0, 200))
  286.     if 0 < notVisibleCount then
  287.       if 1 < smallestVisible then
  288.         dxDrawRectangle(menuPosX + menuWidth, menuPosY + (menuHeight - menuHeight / #tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu * visibleCount) / notVisibleCount * (smallestVisible - 1), 3, menuHeight / #tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu * visibleCount, tocolor(255, 255, 255, 255))
  289.       else
  290.         dxDrawRectangle(menuPosX + menuWidth, menuPosY, 3, menuHeight / #tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu * visibleCount, tocolor(255, 255, 255, 255))
  291.       end
  292.     end
  293.     for _FORV_14_ = 1, #tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu do
  294.       if _UPVALUE0_[_FORV_14_] then
  295.         if (selectedMenu ~= _FORV_14_ or true) and 0 % 2 ~= 0 then
  296.           dxDrawRectangle(menuPosX, menuPosY + 0 * rowHeight, menuWidth, rowHeight, tocolor(0, 0, 0, 200))
  297.         end
  298.       end
  299.     end
  300.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu] then
  301.       if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  302.         if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value == 0 then
  303.         elseif tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType == "premium" then
  304.         end
  305.       end
  306.     end
  307.     if true then
  308.       dxDrawRectangle(menuPosX, interpolateBetween(_UPVALUE10_, 0, 0, _UPVALUE11_, 0, 0, (getTickCount() - _UPVALUE8_) / _UPVALUE9_, "Linear"))
  309.     else
  310.       dxDrawRectangle(menuPosX, _UPVALUE11_, menuWidth, rowHeight, (tocolor(50, 179, 239, 200)))
  311.     end
  312.     for _FORV_18_ = 1, #tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu do
  313.       if _UPVALUE0_[_FORV_18_] then
  314.         if tuningContainer[currentLevel].subMenu[currentSubLevel] and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_] then
  315.           if tuningContainer[currentLevel].subMenu[currentSubLevel].clientFunction and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].value then
  316.             if tuningContainer[currentLevel].subMenu[currentSubLevel].clientFunction(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].value) then
  317.               dxDrawImage(menuPosX + respc(10), menuPosY + 0 * rowHeight + respc(4), respc(32), respc(32), "files/icons/felszerelt.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
  318.               dxDrawText(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].name .. " #32b3ef(Felszerelve)", menuPosX, menuPosY + 0 * rowHeight, menuPosX + menuWidth - respc(20), menuPosY + 0 * rowHeight + rowHeight, tocolor(255, 255, 255, 255), 1, Roboto, "right", "center", false, false, true, true, true)
  319.             else
  320.               dxDrawImage(menuPosX + respc(10), menuPosY + 0 * rowHeight + respc(4), respc(32), respc(32), tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].icon, 0, 0, 0, tocolor(255, 255, 255, 255), true)
  321.               dxDrawText(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].name, menuPosX, menuPosY + 0 * rowHeight, menuPosX + menuWidth - respc(20), menuPosY + 0 * rowHeight + rowHeight, tocolor(255, 255, 255, 255), 1, Roboto, "right", "center", false, false, true, true, true)
  322.             end
  323.           else
  324.             dxDrawImage(menuPosX + respc(10), menuPosY + 0 * rowHeight + respc(4), respc(32), respc(32), tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].icon, 0, 0, 0, tocolor(255, 255, 255, 255), true)
  325.             dxDrawText(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].name, menuPosX, menuPosY + 0 * rowHeight, menuPosX + menuWidth - respc(20), menuPosY + 0 * rowHeight + rowHeight, tocolor(255, 255, 255, 255), 1, Roboto, "right", "center", false, false, true, true, true)
  326.           end
  327.         else
  328.           dxDrawImage(menuPosX + respc(10), menuPosY + 0 * rowHeight + respc(4), respc(32), respc(32), tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].icon, 0, 0, 0, tocolor(255, 255, 255, 255), true)
  329.           dxDrawText(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[_FORV_18_].name, menuPosX, menuPosY + 0 * rowHeight, menuPosX + menuWidth - respc(20), menuPosY + 0 * rowHeight + rowHeight, tocolor(255, 255, 255, 255), 1, Roboto, "right", "center", false, false, true, true, true)
  330.         end
  331.       end
  332.     end
  333.     if _FOR_ then
  334.       dxDrawRectangle(menuPosX, menuPosY + menuHeight, respc(400), respc(60), tocolor(0, 0, 0, 200))
  335.       dxDrawRectangle(menuPosX + respc(400) / 2 - respc(25), menuPosY + menuHeight + respc(10), respc(50), respc(40), tocolor(0, 0, 0, 200))
  336.       dxDrawText(_UPVALUE12_[1], menuPosX + respc(400) / 2 - respc(25), menuPosY + menuHeight + respc(10), menuPosX + respc(400) / 2 + respc(25), menuPosY + menuHeight + respc(10) + respc(40), tocolor(255, 255, 255, 255), 0.55, Roboto3, "center", "center", false, false, true, true, true)
  337.     end
  338.     if editPlate then
  339.       dxDrawRectangle(menuPosX, menuPosY + menuHeight, respc(400), respc(60), tocolor(0, 0, 0, 200))
  340.       dxDrawRectangle(menuPosX, menuPosY + menuHeight, respc(400), 2, tocolor(0, 0, 0, 200))
  341.       dxDrawRectangle(menuPosX, menuPosY + menuHeight + respc(60) - 2, respc(400), 2, tocolor(0, 0, 0, 200))
  342.       dxDrawRectangle(menuPosX, menuPosY + menuHeight + 2, 2, respc(60) - 4, tocolor(0, 0, 0, 200))
  343.       dxDrawRectangle(menuPosX + respc(400) - 2, menuPosY + menuHeight + 2, 2, respc(60) - 4, tocolor(0, 0, 0, 200))
  344.       dxDrawRectangle(menuPosX + respc(10), menuPosY + menuHeight + respc(10), respc(400) - respc(20), respc(40), tocolor(100, 100, 100, 160))
  345.       dxDrawText(getVehiclePlateText(vehicleElement) or "":upper(), menuPosX + respc(4), menuPosY + menuHeight + respc(14), menuPosX + respc(400) - respc(9), 0, tocolor(255, 255, 255, 255), 1, Roboto2, "center", "top", false, false, true, true, true)
  346.     end
  347.     if _UPVALUE13_ + _UPVALUE14_ > getTickCount() then
  348.       dxDrawRectangle(screenWidth / 2 - respc(200), screenHeight - respc(120), respc(400), respc(30), tocolor(0, 0, 0, 160))
  349.       dxDrawRectangle(screenWidth / 2 - respc(200), screenHeight - respc(120), reMap(getTickCount() - _UPVALUE13_, 0, _UPVALUE14_, 0, respc(400)), respc(30), tocolor(124, 197, 118, 160))
  350.       dxDrawText(_UPVALUE15_, screenWidth / 2 - respc(200), screenHeight - respc(120) + 1, screenWidth / 2 - respc(200) + respc(400), screenHeight - respc(120) + respc(30), tocolor(255, 255, 255, 255), 1, Roboto4, "center", "center", false, false, true, true, true)
  351.     end
  352.     if _UPVALUE16_ then
  353.       buttons = {}
  354.       dxDrawRectangle(screenWidth / 2 - respc(600) / 2, screenHeight / 2 - respc(200) / 2, respc(600), respc(200), tocolor(0, 0, 0, 150))
  355.       if "premium" == "premium" then
  356.       else
  357.       end
  358.       dxDrawText("#FFFFFFT\195\169nyleg meg szeretn\195\169d v\195\161s\195\161rolni a kiv\195\161lasztott tuningot?\n" .. ("premium" == "premium" and "#32b3ef" or "#7cc576") .. "A tuning \195\161ra: " .. "Ingyenes", screenWidth / 2 - respc(600) / 2, screenHeight / 2 - respc(200) / 2, screenWidth / 2 - respc(600) / 2 + respc(600), screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100), tocolor(255, 255, 255, 255), 1, Roboto, "center", "center", false, false, false, true)
  359.       dxDrawRectangle(screenWidth / 2 - respc(600) / 2 + respc(30), screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100) + respc(30), respc(600) / 2 - respc(30) * 2, respc(100) - respc(30) * 2, tocolor(217, 83, 79, 150))
  360.       dxDrawText("M\195\169gsem (Backspace)", screenWidth / 2 - respc(600) / 2 + respc(30), screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100) + respc(30), screenWidth / 2 - respc(600) / 2 + respc(30) + respc(600) / 2 - respc(30) * 2, screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100) + respc(30) + 100 - respc(30) * 2, tocolor(0, 0, 0, 255), 1, Roboto, "center", "center", false, false, false, true)
  361.       dxDrawRectangle(screenWidth / 2 - respc(600) / 2 + respc(600) / 2 + respc(30), screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100) + respc(30), respc(600) / 2 - respc(30) * 2, respc(100) - respc(30) * 2, tocolor(124, 197, 118, 150))
  362.       dxDrawText("V\195\161s\195\161rl\195\161s (Enter)", screenWidth / 2 - respc(600) / 2 + respc(600) / 2 + respc(30), screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100) + respc(30), screenWidth / 2 - respc(600) / 2 + respc(600) / 2 + respc(30) + respc(600) / 2 - respc(30) * 2, screenHeight / 2 - respc(200) / 2 + respc(200) - respc(100) + respc(30) + respc(100) - respc(30) * 2, tocolor(0, 0, 0, 255), 1, Roboto, "center", "center", false, false, false, true)
  363.       dxDrawText("#7cc576SeeMTA - #FF9600Tuning", screenWidth / 2 - respc(600) / 2, screenHeight / 2 - respc(200) / 2 - respc(20), screenWidth / 2 - respc(600) / 2, screenHeight / 2 - respc(200) / 2, tocolor(255, 255, 255, 255), 1, Roboto, "left", "center", false, false, false, true)
  364.       activeButton = false
  365.       for _FORV_24_, _FORV_25_ in pairs(buttons) do
  366.         if getCursorPosition() >= _FORV_25_[1] and getCursorPosition() <= _FORV_25_[3] and getCursorPosition() >= _FORV_25_[2] and getCursorPosition() <= _FORV_25_[4] then
  367.           activeButton = _FORV_24_
  368.         end
  369.       end
  370.     end
  371.   end
  372. end)
  373. addEvent("resetSpinner", true)
  374. addEventHandler("resetSpinner", getRootElement(), function(_ARG_0_)
  375.   if isElement(source) then
  376.     setElementData(source, "tuningSpinners", _ARG_0_)
  377.     outputDebugString("resetSpinner")
  378.   end
  379. end)
  380. addEventHandler("onClientKey", getRootElement(), function(_ARG_0_, _ARG_1_)
  381.   if panelState and _ARG_1_ then
  382.     if activeColorInput then
  383.       cancelEvent()
  384.       return
  385.     end
  386.     if (_ARG_0_ == "mouse_wheel_up" or _ARG_0_ == "mouse_wheel_down") and not _UPVALUE0_ and not _UPVALUE1_ then
  387.       if _ARG_0_ == "mouse_wheel_down" then
  388.         if _UPVALUE2_ > 1 and _UPVALUE3_ == "base" or _UPVALUE2_ > 0.75 and _UPVALUE3_ ~= "base" then
  389.           if _UPVALUE3_ ~= "base" then
  390.           else
  391.           end
  392.           _UPVALUE4_ = {_UPVALUE2_, 1}
  393.           _UPVALUE0_ = getTickCount()
  394.         end
  395.       elseif _UPVALUE2_ <= 3 then
  396.         _UPVALUE4_ = {
  397.           _UPVALUE2_,
  398.           _UPVALUE2_ + 0.2 * _UPVALUE2_
  399.         }
  400.         _UPVALUE0_ = getTickCount()
  401.       end
  402.     end
  403.     if not buyingInProgress and _UPVALUE5_ + _UPVALUE6_ <= getTickCount() then
  404.       if selectionLevel == 1 then
  405.       elseif selectionLevel == 2 then
  406.       end
  407.       if variantEditor and getTickCount() - _UPVALUE7_ >= 250 then
  408.         if _ARG_0_ == "arrow_u" then
  409.           _UPVALUE8_[variantEditor] = _UPVALUE8_[variantEditor] + 1
  410.           if _UPVALUE8_[variantEditor] > 6 then
  411.             _UPVALUE8_[variantEditor] = 0
  412.           end
  413.           triggerServerEvent("previewVariant", vehicleElement, _UPVALUE8_)
  414.         elseif _ARG_0_ == "arrow_d" then
  415.           _UPVALUE8_[variantEditor] = _UPVALUE8_[variantEditor] - 1
  416.           if _UPVALUE8_[variantEditor] < 0 then
  417.             _UPVALUE8_[variantEditor] = 6
  418.           end
  419.           triggerServerEvent("previewVariant", vehicleElement, _UPVALUE8_)
  420.         end
  421.         _UPVALUE7_ = getTickCount()
  422.       end
  423.       if _ARG_0_ == "arrow_u" and not _UPVALUE9_ and not variantEditor then
  424.         if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu - 1] then
  425.           if selectedMenu <= _UPVALUE10_ then
  426.             moveSelection(_UPVALUE10_ - 1)
  427.           end
  428.           selectedMenu = selectedMenu - 1
  429.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].colorPicker then
  430.             colorPicker = true
  431.             colorInputs = false
  432.             colorX = false
  433.           else
  434.             colorPicker = false
  435.           end
  436.           if selectionLevel == 2 and tuningContainer[currentLevel].subMenu[currentSubLevel].hornSound then
  437.             if isElement(_UPVALUE11_) then
  438.               destroyElement(_UPVALUE11_)
  439.             end
  440.             if 0 < tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  441.               _UPVALUE11_ = playSound(":sas_customhorn/horns/" .. tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value .. ".mp3")
  442.             end
  443.           end
  444.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].licensePlate then
  445.             togglePlateEdit(true)
  446.           else
  447.             togglePlateEdit(false)
  448.           end
  449.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].isSpinnerItem then
  450.             if colorPicker then
  451.               exports.sas_spinner:previewSpinner(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, true)
  452.             else
  453.               exports.sas_spinner:previewSpinner(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value)
  454.             end
  455.           end
  456.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].id == "color" then
  457.             setVehicleColor(vehicleElement, vehicleColor[1], vehicleColor[2], vehicleColor[3], vehicleColor[4], vehicleColor[5], vehicleColor[6], vehicleColor[7], vehicleColor[8], vehicleColor[9], vehicleColor[10], vehicleColor[11], vehicleColor[12])
  458.             setVehicleHeadLightColor(vehicleElement, vehicleLightColor[1], vehicleLightColor[2], vehicleLightColor[3])
  459.             if not tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].id2 and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].camera then
  460.               changeCamera(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].camera)
  461.             end
  462.           end
  463.           if isElement(_UPVALUE12_) then
  464.             destroyElement(_UPVALUE12_)
  465.           end
  466.           _UPVALUE12_ = nil
  467.           playSound("files/sounds/menunavigate.mp3")
  468.         else
  469.         end
  470.         if selectionLevel == 2 then
  471.           installOpticalTuning()
  472.           installNeon()
  473.           installHandling()
  474.           installDoor()
  475.           installPaintjob()
  476.           installHeadlight()
  477.         end
  478.       elseif _ARG_0_ == "arrow_d" and not _UPVALUE9_ and not variantEditor then
  479.         if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu + 1] then
  480.           if _UPVALUE13_[selectedMenu + 1] then
  481.             moveSelection(selectedMenu + 1)
  482.           end
  483.           selectedMenu = selectedMenu + 1
  484.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].colorPicker then
  485.             colorPicker = true
  486.             colorInputs = false
  487.             colorX = false
  488.           else
  489.             colorPicker = false
  490.           end
  491.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].licensePlate then
  492.             togglePlateEdit(true)
  493.           else
  494.             togglePlateEdit(false)
  495.           end
  496.           if selectionLevel == 2 and tuningContainer[currentLevel].subMenu[currentSubLevel].hornSound then
  497.             if isElement(_UPVALUE11_) then
  498.               destroyElement(_UPVALUE11_)
  499.             end
  500.             if 0 < tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  501.               _UPVALUE11_ = playSound(":sas_customhorn/horns/" .. tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value .. ".mp3")
  502.             end
  503.           end
  504.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].id == "color" then
  505.             setVehicleColor(vehicleElement, vehicleColor[1], vehicleColor[2], vehicleColor[3], vehicleColor[4], vehicleColor[5], vehicleColor[6], vehicleColor[7], vehicleColor[8], vehicleColor[9], vehicleColor[10], vehicleColor[11], vehicleColor[12])
  506.             setVehicleHeadLightColor(vehicleElement, vehicleLightColor[1], vehicleLightColor[2], vehicleLightColor[3])
  507.             if not tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].id2 and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].camera then
  508.               changeCamera(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].camera)
  509.             end
  510.           end
  511.           if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].isSpinnerItem then
  512.             if colorPicker then
  513.               exports.sas_spinner:previewSpinner(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, true)
  514.             else
  515.               exports.sas_spinner:previewSpinner(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value)
  516.             end
  517.           end
  518.           playSound("files/sounds/menunavigate.mp3")
  519.           if selectionLevel == 2 and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].supercharger and _UPVALUE14_[getElementModel(vehicleElement)] then
  520.             _UPVALUE12_ = createObject(2052, 0, 0, 0)
  521.             attachElements(_UPVALUE12_, vehicleElement, unpack(_UPVALUE14_[getElementModel(vehicleElement)]))
  522.             setElementCollisionsEnabled(_UPVALUE12_, false)
  523.             setElementPosition(vehicleElement, getElementPosition(vehicleElement))
  524.             setElementPosition(vehicleElement, getElementPosition(vehicleElement))
  525.           end
  526.         else
  527.         end
  528.         if selectionLevel == 2 then
  529.           installOpticalTuning()
  530.           installNeon()
  531.           installHandling()
  532.           installDoor()
  533.           installPaintjob()
  534.           installHeadlight()
  535.         end
  536.       elseif _ARG_0_ == "enter" then
  537.         if _UPVALUE9_ then
  538.           buyTuning()
  539.           _UPVALUE9_ = false
  540.         elseif selectionLevel == 0 then
  541.           currentLevel = selectedMenu
  542.           selectionLevel = 1
  543.           selectedMenu = 1
  544.           moveSelection(1)
  545.           if tuningContainer[currentLevel].subMenu[selectedMenu].colorPicker then
  546.             colorPicker = true
  547.             colorInputs = false
  548.             colorX = false
  549.           else
  550.             colorPicker = false
  551.           end
  552.           playSound("files/sounds/menuselect.mp3")
  553.         elseif selectionLevel == 1 then
  554.           if tuningContainer[currentLevel].subMenu[selectedMenu] then
  555.             if variantEditor then
  556.               confirmTuning()
  557.               return
  558.             end
  559.             if (tuningContainer[currentLevel].subMenu[selectedMenu].handlingPrefix == "WHEEL_F_" or tuningContainer[currentLevel].subMenu[selectedMenu].handlingPrefix == "WHEEL_R_") and getElementData(vehicleElement, "tuningSpinners") then
  560.               exports.sas_accounts:showInfo("e", "El\197\145bb szereld le a spinnert!")
  561.               return
  562.             end
  563.             if tuningContainer[currentLevel].subMenu[selectedMenu].isSpinner then
  564.               if _UPVALUE15_[getElementModel(vehicleElement)] or getVehicleType(vehicleElement) ~= "Automobile" then
  565.                 exports.sas_accounts:showInfo("e", "Ez az alkatr\195\169sz nem kompatibilis a j\195\161rm\197\177veddel!")
  566.                 return
  567.               end
  568.               for _FORV_10_ in pairs(getVehicleHandlingFlags(vehicleElement)) do
  569.                 if string.sub(_FORV_10_, 1, 6) == "WHEEL_" then
  570.                   exports.sas_accounts:showInfo("e", "El\197\145bb szereld \195\161t a kerekeid sz\195\169less\195\169g\195\169t norm\195\161lra!")
  571.                   return
  572.                 end
  573.               end
  574.               exports.sas_spinner:getSizeForPreview(vehicleElement)
  575.               exports.sas_spinner:previewSpinner(vehicleElement, tuningContainer[currentLevel].subMenu[selectedMenu].subMenu[1].value, r, g, b)
  576.             end
  577.             if tuningContainer[currentLevel].subMenu[selectedMenu].variantEditor then
  578.               variantEditor = 1
  579.               _UPVALUE8_ = {}
  580.               _UPVALUE8_[1] = getElementData(vehicleElement, "variant1") or 0
  581.               _UPVALUE8_[2] = getElementData(vehicleElement, "variant2") or 0
  582.               return
  583.             else
  584.               variantEditor = false
  585.             end
  586.             if tuningContainer[currentLevel].subMenu[selectedMenu].upgradeSlot then
  587.               tuningContainer[currentLevel].subMenu[selectedMenu].subMenu = {}
  588.               if getVehicleCompatibleUpgrades(vehicleElement, tuningContainer[currentLevel].subMenu[selectedMenu].upgradeSlot) and 0 < #getVehicleCompatibleUpgrades(vehicleElement, tuningContainer[currentLevel].subMenu[selectedMenu].upgradeSlot) then
  589.                 table.insert(tuningContainer[currentLevel].subMenu[selectedMenu].subMenu, {
  590.                   name = "Gy\195\161ri",
  591.                   icon = tuningContainer[currentLevel].subMenu[selectedMenu].icon,
  592.                   priceType = "free",
  593.                   price = 0,
  594.                   value = 0
  595.                 })
  596.                 for _FORV_10_, _FORV_11_ in ipairs((getVehicleCompatibleUpgrades(vehicleElement, tuningContainer[currentLevel].subMenu[selectedMenu].upgradeSlot))) do
  597.                   table.insert(tuningContainer[currentLevel].subMenu[selectedMenu].subMenu, {
  598.                     name = componentNames[_FORV_11_],
  599.                     icon = tuningContainer[currentLevel].subMenu[selectedMenu].icon,
  600.                     priceType = tuningContainer[currentLevel].subMenu[selectedMenu].priceType,
  601.                     price = tuningContainer[currentLevel].subMenu[selectedMenu].price,
  602.                     value = _FORV_11_
  603.                   })
  604.                 end
  605.               else
  606.                 tuningContainer[currentLevel].subMenu[selectedMenu].subMenu = false
  607.               end
  608.             elseif tuningContainer[currentLevel].subMenu[selectedMenu].id == "paintjob" then
  609.               if exports.sas_paintjob:getPaintJobCount(getElementModel(vehicleElement)) then
  610.                 tuningContainer[currentLevel].subMenu[selectedMenu].subMenu = {}
  611.                 table.insert(tuningContainer[currentLevel].subMenu[selectedMenu].subMenu, {
  612.                   name = "Gy\195\161ri",
  613.                   icon = "files/icons/free.png",
  614.                   priceType = "free",
  615.                   price = 0,
  616.                   value = 0
  617.                 })
  618.                 for _FORV_10_ = 1, exports.sas_paintjob:getPaintJobCount(getElementModel(vehicleElement)) do
  619.                   table.insert(tuningContainer[currentLevel].subMenu[selectedMenu].subMenu, {
  620.                     name = "Paintjob " .. _FORV_10_,
  621.                     icon = "files/icons/pp.png",
  622.                     priceType = "premium",
  623.                     price = 1800,
  624.                     value = _FORV_10_
  625.                   })
  626.                 end
  627.               end
  628.             elseif tuningContainer[currentLevel].subMenu[selectedMenu].id == "headlight" then
  629.               if exports.sas_headlight:getHeadLightCount(getElementModel(vehicleElement)) then
  630.                 tuningContainer[currentLevel].subMenu[selectedMenu].subMenu = {}
  631.                 table.insert(tuningContainer[currentLevel].subMenu[selectedMenu].subMenu, {
  632.                   name = "Gy\195\161ri",
  633.                   icon = "files/icons/free.png",
  634.                   priceType = "free",
  635.                   price = 0,
  636.                   value = 0,
  637.                   hint = "V\195\161s\195\161rl\195\161s el\197\145tt aj\195\161nlott fel- \195\169s lekapcsolt l\195\161mp\195\161val is megtekinteni a j\195\161rm\197\177vet. (L gomb)"
  638.                 })
  639.                 for _FORV_10_ = 1, exports.sas_headlight:getHeadLightCount(getElementModel(vehicleElement)) do
  640.                   table.insert(tuningContainer[currentLevel].subMenu[selectedMenu].subMenu, {
  641.                     name = "F\195\169nysz\195\179r\195\179 " .. _FORV_10_,
  642.                     icon = "files/icons/pp.png",
  643.                     priceType = "premium",
  644.                     price = 1200,
  645.                     value = _FORV_10_,
  646.                     hint = "V\195\161s\195\161rl\195\161s el\197\145tt aj\195\161nlott fel- \195\169s lekapcsolt l\195\161mp\195\161val is megtekinteni a j\195\161rm\197\177vet. (L gomb)"
  647.                   })
  648.                 end
  649.               end
  650.             elseif tuningContainer[currentLevel].subMenu[selectedMenu].id == "color" then
  651.               colorPicker = true
  652.               colorInputs = false
  653.               colorX = false
  654.             end
  655.           end
  656.           if tuningContainer[currentLevel].subMenu[selectedMenu].subMenu then
  657.             currentSubLevel = selectedMenu
  658.             selectionLevel = 2
  659.             if tuningContainer[currentLevel].subMenu[selectedMenu] and tuningContainer[currentLevel].subMenu[selectedMenu].camera then
  660.               changeCamera(tuningContainer[currentLevel].subMenu[selectedMenu].camera)
  661.             end
  662.             selectedMenu = 1
  663.             moveSelection(1)
  664.             installOpticalTuning()
  665.             installNeon()
  666.             installHandling()
  667.             installDoor()
  668.             installPaintjob()
  669.             installHeadlight()
  670.             playSound("files/sounds/menuselect.mp3")
  671.           elseif tuningContainer[currentLevel].subMenu[selectedMenu].id == "color" then
  672.             confirmTuning()
  673.           else
  674.             exports.sas_accounts:showInfo("e", "Sajnos a kiv\195\161lasztott alkatr\195\169sz nem kompatibilis a j\195\161rm\197\177veddel!")
  675.           end
  676.         elseif selectionLevel == 2 then
  677.           if tuningContainer[currentLevel].subMenu[currentSubLevel] and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].supercharger and not _UPVALUE14_[getElementModel(vehicleElement)] then
  678.             exports.sas_accounts:showInfo("e", "Ezzel az aut\195\179val nem kompatibilis a supercharger.")
  679.             return
  680.           end
  681.           confirmTuning()
  682.         end
  683.       elseif _ARG_0_ == "backspace" then
  684.         if _UPVALUE9_ then
  685.           _UPVALUE9_ = false
  686.         elseif variantEditor then
  687.           variantEditor = false
  688.           triggerServerEvent("previewVariant", vehicleElement, false)
  689.         elseif not editPlate then
  690.           colorPicker = false
  691.           togglePlateEdit(false)
  692.           if selectionLevel > 0 then
  693.             if selectionLevel == 1 then
  694.               if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].id == "color" then
  695.                 setVehicleColor(vehicleElement, vehicleColor[1], vehicleColor[2], vehicleColor[3], vehicleColor[4], vehicleColor[5], vehicleColor[6], vehicleColor[7], vehicleColor[8], vehicleColor[9], vehicleColor[10], vehicleColor[11], vehicleColor[12])
  696.                 setVehicleHeadLightColor(vehicleElement, vehicleLightColor[1], vehicleLightColor[2], vehicleLightColor[3])
  697.               end
  698.               currentLevel = 0
  699.               selectionLevel = 0
  700.               currentSubLevel = 1
  701.               moveSelection(1)
  702.               selectedMenu = 1
  703.             elseif selectionLevel == 2 then
  704.               if tuningContainer[currentLevel].subMenu[currentSubLevel].isSpinner then
  705.                 triggerServerEvent("resetSpinner", vehicleElement)
  706.               end
  707.               restoreOpticalTuning()
  708.               restoreNeon()
  709.               restoreHandling()
  710.               restoreDoor()
  711.               restorePaintjob()
  712.               restoreHeadlight()
  713.               if tuningContainer[currentLevel].subMenu[currentSubLevel].id == "color" then
  714.                 setVehicleColor(vehicleElement, vehicleColor[1], vehicleColor[2], vehicleColor[3], vehicleColor[4], vehicleColor[5], vehicleColor[6], vehicleColor[7], vehicleColor[8], vehicleColor[9], vehicleColor[10], vehicleColor[11], vehicleColor[12])
  715.                 setVehicleHeadLightColor(vehicleElement, vehicleLightColor[1], vehicleLightColor[2], vehicleLightColor[3])
  716.               end
  717.               selectionLevel = 1
  718.               currentSubLevel = 1
  719.               moveSelection(1)
  720.               selectedMenu = 1
  721.               changeCamera("base")
  722.             end
  723.           else
  724.             triggerServerEvent("exitTuning", localPlayer)
  725.           end
  726.           if isElement(_UPVALUE12_) then
  727.             destroyElement(_UPVALUE12_)
  728.           end
  729.           _UPVALUE12_ = nil
  730.           playSound("files/sounds/menuback.mp3")
  731.         elseif 1 <= utfLen(getVehiclePlateText(vehicleElement) or "") then
  732.           setVehiclePlateText(vehicleElement, (getVehiclePlateText(vehicleElement) or "":sub(1, utfLen(getVehiclePlateText(vehicleElement) or "") - 1)))
  733.         end
  734.       end
  735.     end
  736.     if colorPicker then
  737.       if _ARG_0_ ~= "escape" and _ARG_0_ ~= "l" and _ARG_0_ ~= "mouse1" then
  738.         cancelEvent()
  739.       end
  740.     elseif _ARG_0_ ~= "escape" and _ARG_0_ ~= "l" then
  741.       cancelEvent()
  742.     end
  743.   end
  744. end)
  745. addEventHandler("onClientCharacter", getRootElement(), function(_ARG_0_)
  746.   if panelState and editPlate and (string.find(_ARG_0_, "[a-z]") or string.find(_ARG_0_, "[0-9]") or _ARG_0_ == "-") then
  747.     if utfLen(getVehiclePlateText(vehicleElement) or "") < 8 then
  748.       setVehiclePlateText(vehicleElement, (getVehiclePlateText(vehicleElement) or "") .. _ARG_0_:upper())
  749.     end
  750.   end
  751. end)
  752. function restoreOpticalTuning()
  753.   if tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot then
  754.     if getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot) and getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot) > 0 then
  755.       removeVehicleUpgrade(vehicleElement, (getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot)))
  756.     end
  757.     if originalUpgrade and 0 < originalUpgrade then
  758.       addVehicleUpgrade(vehicleElement, originalUpgrade)
  759.       originalUpgrade = false
  760.     end
  761.   end
  762. end
  763. function installOpticalTuning()
  764.   if tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot then
  765.     if getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot) and getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot) > 0 then
  766.       removeVehicleUpgrade(vehicleElement, (getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot)))
  767.       if not originalUpgrade then
  768.         originalUpgrade = getVehicleUpgradeOnSlot(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot)
  769.       end
  770.     elseif not originalUpgrade then
  771.       originalUpgrade = 0
  772.     end
  773.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value and 0 < tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  774.       addVehicleUpgrade(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value)
  775.     end
  776.   end
  777. end
  778. function installNeon()
  779.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "neon" then
  780.     if not neonId then
  781.       neonId = getElementData(vehicleElement, "tuning.neon")
  782.     end
  783.     if not neonState then
  784.       neonState = getElementData(vehicleElement, "tuning.neon.state")
  785.     end
  786.     setElementData(vehicleElement, "tuning.neon", tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, false)
  787.     setElementData(vehicleElement, "tuning.neon.state", 1, false)
  788.   end
  789. end
  790. function restoreNeon()
  791.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "neon" then
  792.     if neonState then
  793.       setElementData(vehicleElement, "tuning.neon.state", neonState)
  794.       neonState = false
  795.     end
  796.     if neonId then
  797.       setElementData(vehicleElement, "tuning.neon", neonId)
  798.       neonId = false
  799.     end
  800.   end
  801. end
  802. function installHandling()
  803.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "handling" and tuningContainer[currentLevel].subMenu[currentSubLevel].handlingPrefix then
  804.     if not originalHandling then
  805.       originalHandling = getVehicleHandling(vehicleElement).handlingFlags
  806.     end
  807.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  808.       for _FORV_8_ in pairs(getVehicleHandlingFlags(vehicleElement)) do
  809.       end
  810.       triggerServerEvent("setVehicleHandling", localPlayer, "handlingFlags", getVehicleHandlingFlags(vehicleElement) - handlingFlags[_FORV_8_] + handlingFlags[tuningContainer[currentLevel].subMenu[currentSubLevel].handlingPrefix .. tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value])
  811.     end
  812.   end
  813. end
  814. function restoreHandling()
  815.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "handling" and originalHandling then
  816.     triggerServerEvent("setVehicleHandling", localPlayer, "handlingFlags", originalHandling)
  817.     originalHandling = false
  818.   end
  819. end
  820. function installDoor()
  821.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "door" then
  822.     if not originalDoor then
  823.       originalDoor = getElementData(vehicleElement, "vDoorType") or 0
  824.     end
  825.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  826.       setElementData(vehicleElement, "vDoorType", tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, false)
  827.       if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value == 0 then
  828.         setVehicleDoorOpenRatio(vehicleElement, 2, 0, 500)
  829.         setVehicleDoorOpenRatio(vehicleElement, 3, 0, 500)
  830.       else
  831.         setVehicleDoorOpenRatio(vehicleElement, 2, 1, 500)
  832.         setVehicleDoorOpenRatio(vehicleElement, 3, 1, 500)
  833.       end
  834.     end
  835.   end
  836. end
  837. function restoreDoor()
  838.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "door" then
  839.     setVehicleDoorOpenRatio(vehicleElement, 2, 0, 500)
  840.     setVehicleDoorOpenRatio(vehicleElement, 3, 0, 500)
  841.     if originalDoor ~= false then
  842.       if originalDoor == 0 then
  843.         setElementData(vehicleElement, "vDoorType", false, false)
  844.       else
  845.         setElementData(vehicleElement, "vDoorType", originalDoor, false)
  846.       end
  847.       originalDoor = false
  848.     end
  849.   end
  850. end
  851. function installPaintjob()
  852.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "paintjob" then
  853.     if not originalPaintjob then
  854.       originalPaintjob = getElementData(vehicleElement, "vehicle.currentTexture")
  855.     end
  856.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  857.       exports.sas_paintjob:applyPaintJob(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, false)
  858.     end
  859.   end
  860. end
  861. function restorePaintjob()
  862.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "paintjob" and originalPaintjob then
  863.     setElementData(vehicleElement, "vehicle.currentTexture", originalPaintjob)
  864.     originalPaintjob = false
  865.   end
  866. end
  867. function installHeadlight()
  868.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "headlight" then
  869.     if not originalHeadLight then
  870.       originalHeadLight = getElementData(vehicleElement, "vehicle.currentHeadLight")
  871.     end
  872.     if tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value then
  873.       exports.sas_headlight:applyHeadLight(tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, false)
  874.     end
  875.   end
  876. end
  877. function restoreHeadlight()
  878.   if tuningContainer[currentLevel].subMenu[currentSubLevel].id and tuningContainer[currentLevel].subMenu[currentSubLevel].id == "headlight" and originalHeadLight then
  879.     setElementData(vehicleElement, "vehicle.currentHeadLight", originalHeadLight)
  880.     originalHeadLight = false
  881.   end
  882. end
  883. function togglePlateEdit(_ARG_0_)
  884.   editPlate = _ARG_0_
  885.   if editPlate then
  886.     if not originalPlate then
  887.       originalPlate = getVehiclePlateText(vehicleElement) or ""
  888.     end
  889.   elseif originalPlate then
  890.     setVehiclePlateText(vehicleElement, originalPlate)
  891.     originalPlate = false
  892.   end
  893. end
  894. function moveSelection(_ARG_0_)
  895.   if _ARG_0_ then
  896.     _UPVALUE0_ = getTickCount()
  897.     _UPVALUE1_ = _UPVALUE2_
  898.     _UPVALUE2_ = menuPosY + (_ARG_0_ - 1) * rowHeight
  899.     _UPVALUE3_ = _ARG_0_
  900.   end
  901. end
  902. function confirmTuning()
  903.   if panelState and not buyingInProgress and not _UPVALUE0_ then
  904.     _UPVALUE0_ = true
  905.   end
  906. end
  907. function buyTuning()
  908.   if panelState and not buyingInProgress and _UPVALUE0_ then
  909.     if variantEditor then
  910.       variantEditor = false
  911.       buyingInProgress = true
  912.       triggerServerEvent("buyVariantTuning", localPlayer, _UPVALUE1_, tuningContainer[currentLevel].subMenu[selectedMenu].price)
  913.       return
  914.     end
  915.     if selectionLevel == 2 and tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].isSpinnerItem then
  916.       buyingInProgress = true
  917.       triggerServerEvent("buySpinnerTuning", localPlayer, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, exports.sas_spinner:getPreviewColor())
  918.       return
  919.     end
  920.     if tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot and selectionLevel == 2 then
  921.       triggerServerEvent("buyOpticalTuning", localPlayer, tuningContainer[currentLevel].subMenu[currentSubLevel].upgradeSlot, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price)
  922.       buyingInProgress = true
  923.     elseif tuningContainer[currentLevel].subMenu[currentSubLevel].id == "paintjob" and selectionLevel == 2 then
  924.       triggerServerEvent("buyPaintjob", localPlayer, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price)
  925.       buyingInProgress = true
  926.     elseif tuningContainer[currentLevel].subMenu[currentSubLevel].id == "headlight" and selectionLevel == 2 then
  927.       triggerServerEvent("buyHeadLight", localPlayer, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price)
  928.       buyingInProgress = true
  929.     elseif tuningContainer[currentLevel].subMenu[selectedMenu].id == "color" and selectionLevel == 1 then
  930.       if not compareTables(vehicleColor, {
  931.         getVehicleColor(vehicleElement, true)
  932.       }) or not compareTables(vehicleLightColor, {
  933.         getVehicleHeadLightColor(vehicleElement)
  934.       }) or tuningContainer[currentLevel].subMenu[selectedMenu].colorId == 7 then
  935.         triggerServerEvent("buyColor", localPlayer, tuningContainer[currentLevel].subMenu[selectedMenu].colorId, {
  936.           getVehicleColor(vehicleElement, true)
  937.         }, {
  938.           getVehicleHeadLightColor(vehicleElement)
  939.         }, tuningContainer[currentLevel].subMenu[selectedMenu].priceType, tuningContainer[currentLevel].subMenu[selectedMenu].price)
  940.         triggerEvent("resetSpeedoColor", vehicleElement)
  941.         buyingInProgress = true
  942.       else
  943.         exports.sas_accounts:showInfo("e", "A kiv\195\161lasztott sz\195\173n nem lehet ugyan az, mint a jelenlegi.")
  944.         buyingInProgress = false
  945.       end
  946.     elseif tuningContainer[currentLevel].subMenu[currentSubLevel].id == "color" and selectionLevel == 2 then
  947.       if not compareTables(vehicleColor, {
  948.         getVehicleColor(vehicleElement, true)
  949.       }) or not compareTables(vehicleLightColor, {
  950.         getVehicleHeadLightColor(vehicleElement)
  951.       }) or tuningContainer[currentLevel].subMenu[selectedMenu].colorId == 7 then
  952.         triggerServerEvent("buyColor", localPlayer, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].colorId, {
  953.           getVehicleColor(vehicleElement, true)
  954.         }, {
  955.           getVehicleHeadLightColor(vehicleElement)
  956.         }, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price)
  957.         buyingInProgress = true
  958.       else
  959.         exports.sas_accounts:showInfo("e", "A kiv\195\161lasztott sz\195\173n nem lehet ugyan az, mint a jelenlegi.")
  960.         buyingInProgress = false
  961.       end
  962.     elseif tuningContainer[currentLevel].subMenu[currentSubLevel].id == "licensePlate" and selectionLevel == 2 then
  963.       if getVehiclePlateText(vehicleElement) then
  964.         triggerServerEvent("buyLicensePlate", localPlayer, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].value, getVehiclePlateText(vehicleElement), tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].priceType, tuningContainer[currentLevel].subMenu[currentSubLevel].subMenu[selectedMenu].price)
  965.         buyingInProgress = true
  966.       else
  967.         exports.sas_accounts:showInfo("e", "A j\195\161rm\197\177 nem maradhat rendsz\195\161m n\195\169lk\195\188l!")
  968.         buyingInProgress = false
  969.         togglePlateEdit(false)
  970.       end
  971.     else
  972.       triggerServerEvent("buyTuning", localPlayer, currentLevel, currentSubLevel, selectedMenu)
  973.       buyingInProgress = true
  974.     end
  975.     selectedMenu = 1
  976.     moveSelection(1)
  977.   end
  978. end
  979. addEvent("buyTuning", true)
  980. addEventHandler("buyTuning", getRootElement(), function(_ARG_0_, _ARG_1_, _ARG_2_)
  981.   if _ARG_0_ == "success" then
  982.     neonId = false
  983.     neonState = false
  984.     originalHandling = false
  985.     originalDoor = false
  986.     if _ARG_1_ == "neon" then
  987.       setElementData(vehicleElement, "tuning.neon.state", 0, false)
  988.     elseif _ARG_1_ == "paintjob" and _ARG_2_ then
  989.       exports.sas_paintjob:applyPaintJob(vehicleElement, _ARG_2_, true)
  990.     end
  991.     if _ARG_2_ == 0 then
  992.       startBuyProgress("newpart", "Leszerel\195\169s...")
  993.     else
  994.       startBuyProgress("newpart", "Felszerel\195\169s...")
  995.     end
  996.   elseif _ARG_0_ == "failed" then
  997.     if neonId then
  998.       setElementData(vehicleElement, "tuning.neon", neonId, false)
  999.       neonId = false
  1000.     end
  1001.     if neonState then
  1002.       setElementData(vehicleElement, "tuning.neon.state", neonState, false)
  1003.       neonState = false
  1004.     end
  1005.   end
  1006.   buyingInProgress = false
  1007. end)
  1008. addEvent("buyOpticalTuning", true)
  1009. addEventHandler("buyOpticalTuning", getRootElement(), function(_ARG_0_, _ARG_1_)
  1010.   if _ARG_0_ == "success" then
  1011.     if _ARG_1_ then
  1012.       originalUpgrade = _ARG_1_
  1013.       if _ARG_1_ == 0 then
  1014.         startBuyProgress("newpart", "Leszerel\195\169s...")
  1015.       else
  1016.         startBuyProgress("newpart", "Felszerel\195\169s...")
  1017.       end
  1018.     end
  1019.   elseif _ARG_0_ == "failed" then
  1020.   end
  1021.   buyingInProgress = false
  1022. end)
  1023. addEvent("buyVariant", true)
  1024. addEventHandler("buyVariant", getRootElement(), function(_ARG_0_)
  1025.   if _ARG_0_ == "success" then
  1026.     startBuyProgress("newpart", "Felszerel\195\169s...")
  1027.   elseif _ARG_0_ == "successdown" then
  1028.     startBuyProgress("newpart", "Leszerel\195\169s...")
  1029.   end
  1030.   buyingInProgress = false
  1031. end)
  1032. addEvent("buyPaintjob", true)
  1033. addEventHandler("buyPaintjob", getRootElement(), function(_ARG_0_, _ARG_1_)
  1034.   if _ARG_0_ == "success" then
  1035.     if _ARG_1_ then
  1036.       originalPaintjob = _ARG_1_
  1037.     end
  1038.     exports.sas_paintjob:applyPaintJob(_ARG_1_, true)
  1039.     startBuyProgress("paint", "Fest\195\169s...")
  1040.   elseif _ARG_0_ == "failed" then
  1041.   end
  1042.   buyingInProgress = false
  1043. end)
  1044. addEvent("buyHeadLight", true)
  1045. addEventHandler("buyHeadLight", getRootElement(), function(_ARG_0_, _ARG_1_)
  1046.   if _ARG_0_ == "success" then
  1047.     if _ARG_1_ then
  1048.       originalHeadLight = _ARG_1_
  1049.     end
  1050.     exports.sas_headlight:applyHeadLight(_ARG_1_, true)
  1051.     startBuyProgress("newpart", "Felszerel\195\169s...")
  1052.   elseif _ARG_0_ == "failed" then
  1053.   end
  1054.   buyingInProgress = false
  1055. end)
  1056. addEvent("buyColor", true)
  1057. addEventHandler("buyColor", getRootElement(), function(_ARG_0_, _ARG_1_, _ARG_2_)
  1058.   if _ARG_0_ == "success" then
  1059.     if not compareTables(_ARG_1_, vehicleColor) then
  1060.       vehicleColor = _ARG_1_
  1061.       startBuyProgress("paint", "Fest\195\169s...")
  1062.     end
  1063.     if not compareTables(_ARG_2_, vehicleLightColor) then
  1064.       vehicleLightColor = _ARG_2_
  1065.       startBuyProgress("newpart", "Izz\195\179 cser\195\169je...")
  1066.     end
  1067.   elseif _ARG_0_ == "failed" then
  1068.   end
  1069.   buyingInProgress = false
  1070. end)
  1071. addEvent("buyLicensePlate", true)
  1072. addEventHandler("buyLicensePlate", getRootElement(), function(_ARG_0_, _ARG_1_)
  1073.   if _ARG_0_ == "success" then
  1074.     if _ARG_1_ then
  1075.       originalPlate = _ARG_1_
  1076.     end
  1077.     startBuyProgress("newpart", "Felszerel\195\169s...")
  1078.   elseif _ARG_0_ == "failed" then
  1079.   end
  1080.   togglePlateEdit(false)
  1081.   buyingInProgress = false
  1082. end)
  1083. function startBuyProgress(_ARG_0_, _ARG_1_)
  1084.   if isElement(_UPVALUE0_) then
  1085.     destroyElement(_UPVALUE0_)
  1086.   end
  1087.   _UPVALUE1_ = getTickCount()
  1088.   _UPVALUE2_ = _ARG_1_
  1089.   if _ARG_0_ == "newpart" then
  1090.     _UPVALUE3_ = 6000
  1091.   elseif _ARG_0_ == "paint" then
  1092.     _UPVALUE3_ = 8250
  1093.   end
  1094.   _UPVALUE0_ = playSound("files/sounds/" .. _ARG_0_ .. ".mp3", false)
  1095. end
  1096. function setCameraMatrixRotated(_ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_, _ARG_4_, _ARG_5_)
  1097.   _UPVALUE0_ = {
  1098.     _ARG_0_,
  1099.     _ARG_1_,
  1100.     _ARG_2_,
  1101.     _ARG_3_,
  1102.     _ARG_4_,
  1103.     _ARG_5_
  1104.   }
  1105.   if not tonumber(camRotation) then
  1106.     camRotation = 0
  1107.   end
  1108.   if not tonumber(camOffsetZ) then
  1109.     camOffsetZ = 0
  1110.   end
  1111.   if not tonumber(_UPVALUE1_) then
  1112.     _UPVALUE1_ = 1
  1113.   end
  1114.   setCameraMatrix(_ARG_3_ + (_ARG_0_ - _ARG_3_) * math.cos((math.rad(camRotation + 10))) - (_ARG_1_ - _ARG_4_) * math.sin((math.rad(camRotation + 10))), _ARG_4_ + (_ARG_0_ - _ARG_3_) * math.sin((math.rad(camRotation + 10))) + (_ARG_1_ - _ARG_4_) * math.cos((math.rad(camRotation + 10))), _ARG_2_ + camOffsetZ, _ARG_3_, _ARG_4_, _ARG_5_, 0, 70 / (_UPVALUE1_ or 1))
  1115. end
  1116. addEventHandler("onClientPreRender", getRootElement(), function()
  1117.   if panelState then
  1118.     if not tonumber(camRotation) then
  1119.       camRotation = 0
  1120.     end
  1121.     if not tonumber(camOffsetZ) then
  1122.       camOffsetZ = 0
  1123.     end
  1124.     if getKeyState("mouse1") and not _UPVALUE0_ and not true and not isPicking and not isLuminancePicking then
  1125.       if not _UPVALUE1_ then
  1126.         _UPVALUE1_ = {
  1127.           getCursorPosition()
  1128.         }
  1129.       end
  1130.       camRotation = _UPVALUE1_[3] - (getCursorPosition() - _UPVALUE1_[1]) / screenWidth * 270
  1131.       if camRotation > 360 then
  1132.         camRotation = camRotation - 360
  1133.       end
  1134.       if camRotation < 0 then
  1135.         camRotation = camRotation + 360
  1136.       end
  1137.       camOffsetZ = _UPVALUE1_[4] + (getCursorPosition() - _UPVALUE1_[2]) / screenHeight * 10
  1138.       if camOffsetZ < -2 then
  1139.         camOffsetZ = -2
  1140.       end
  1141.       if camOffsetZ > 2 then
  1142.         camOffsetZ = 2
  1143.       end
  1144.     else
  1145.       _UPVALUE1_ = false
  1146.     end
  1147.     if _UPVALUE2_ and not _UPVALUE0_ then
  1148.       _UPVALUE3_ = interpolateBetween(_UPVALUE4_[1], 0, 0, _UPVALUE4_[2], 0, 0, (getTickCount() - _UPVALUE2_) / 150, "InOutQuad")
  1149.       if 1 <= (getTickCount() - _UPVALUE2_) / 150 then
  1150.         _UPVALUE2_ = false
  1151.       end
  1152.     end
  1153.     if _UPVALUE0_ then
  1154.       camRotation, camOffsetZ, _UPVALUE3_ = interpolateBetween(_UPVALUE5_[7], _UPVALUE5_[8], _UPVALUE5_[9], 0, 0, 1, (getTickCount() - _UPVALUE0_) / 600, "InOutQuad")
  1155.       if 1 <= (getTickCount() - _UPVALUE0_) / 600 then
  1156.         _UPVALUE0_ = false
  1157.         _UPVALUE2_ = false
  1158.       end
  1159.       setCameraMatrixRotated(interpolateBetween(_UPVALUE5_[1], _UPVALUE5_[2], _UPVALUE5_[3], _UPVALUE6_[1], _UPVALUE6_[2], _UPVALUE6_[3], (getTickCount() - _UPVALUE0_) / 600, "InOutQuad"))
  1160.       for _FORV_17_ in pairs((getVehicleComponents(vehicleElement))) do
  1161.         setVehicleComponentVisible(vehicleElement, _FORV_17_, true)
  1162.       end
  1163.       if currentLevel and currentSubLevel and selectionLevel == 2 and tuningContainer[currentLevel].subMenu[currentSubLevel] and tuningContainer[currentLevel].subMenu[currentSubLevel].hideComponent then
  1164.         setVehicleComponentVisible(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].hideComponent, false)
  1165.       end
  1166.     else
  1167.       setCameraMatrixRotated(unpack(_UPVALUE6_))
  1168.       if currentLevel and currentSubLevel and selectionLevel == 2 and tuningContainer[currentLevel].subMenu[currentSubLevel] then
  1169.       end
  1170.       if tuningContainer[currentLevel].subMenu[currentSubLevel].hideComponent and not _UPVALUE7_ then
  1171.         setVehicleComponentVisible(vehicleElement, tuningContainer[currentLevel].subMenu[currentSubLevel].hideComponent, false)
  1172.       else
  1173.         for _FORV_8_ in pairs((getVehicleComponents(vehicleElement))) do
  1174.           setVehicleComponentVisible(vehicleElement, _FORV_8_, true)
  1175.         end
  1176.       end
  1177.     end
  1178.   end
  1179. end)
  1180. function shallowcopy(_ARG_0_)
  1181.   if type(_ARG_0_) == "table" then
  1182.     for _FORV_6_, _FORV_7_ in pairs(_ARG_0_) do
  1183.     end
  1184.   else
  1185.   end
  1186.   return _ARG_0_
  1187. end
  1188. function changeCamera(_ARG_0_)
  1189.   if _UPVALUE0_ == _ARG_0_ then
  1190.     return
  1191.   end
  1192.   if _ARG_0_ == "base" then
  1193.     _UPVALUE1_ = shallowcopy(_UPVALUE2_)
  1194.     _UPVALUE1_[7] = camRotation
  1195.     _UPVALUE1_[8] = camOffsetZ
  1196.     _UPVALUE1_[9] = _UPVALUE3_
  1197.     _UPVALUE4_ = _UPVALUE5_
  1198.     _UPVALUE6_ = getTickCount()
  1199.     playSound("files/sounds/cammove.mp3")
  1200.     _UPVALUE0_ = _ARG_0_
  1201.   elseif _ARG_0_ == "lightpaint" then
  1202.     _UPVALUE1_ = shallowcopy(_UPVALUE2_)
  1203.     _UPVALUE1_[7] = camRotation
  1204.     _UPVALUE1_[8] = camOffsetZ
  1205.     _UPVALUE1_[9] = _UPVALUE3_
  1206.     _UPVALUE4_ = {
  1207.       getElementPosition(vehicleElement) + (0 + (0 - 0) * math.cos((math.rad(getElementRotation(vehicleElement)))) - (10 - 0) * math.sin((math.rad(getElementRotation(vehicleElement))))),
  1208.       getElementPosition(vehicleElement) + (0 + (0 - 0) * math.sin((math.rad(getElementRotation(vehicleElement)))) + (10 - 0) * math.cos((math.rad(getElementRotation(vehicleElement))))),
  1209.       getElementPosition(vehicleElement)
  1210.     }
  1211.     _UPVALUE6_ = getTickCount()
  1212.     playSound("files/sounds/cammove.mp3")
  1213.     _UPVALUE0_ = _ARG_0_
  1214.   elseif string.gsub(_ARG_0_, "_excomp", "") and getVehicleComponents(vehicleElement)[string.gsub(_ARG_0_, "_excomp", "")] then
  1215.     _UPVALUE1_ = shallowcopy(_UPVALUE2_)
  1216.     _UPVALUE1_[7] = camRotation
  1217.     _UPVALUE1_[8] = camOffsetZ
  1218.     _UPVALUE1_[9] = _UPVALUE3_
  1219.     _UPVALUE4_ = {
  1220.       getVehicleComponentPosition(vehicleElement, string.gsub(_ARG_0_, "_excomp", ""), "world") + (0 + (componentOffsets[_ARG_0_][1] - 0) * math.cos((math.rad(getElementRotation(vehicleElement)))) - (componentOffsets[_ARG_0_][2] - 0) * math.sin((math.rad(getElementRotation(vehicleElement))))),
  1221.       getVehicleComponentPosition(vehicleElement, string.gsub(_ARG_0_, "_excomp", ""), "world") + (0 + (componentOffsets[_ARG_0_][1] - 0) * math.sin((math.rad(getElementRotation(vehicleElement)))) + (componentOffsets[_ARG_0_][2] - 0) * math.cos((math.rad(getElementRotation(vehicleElement))))),
  1222.       getVehicleComponentPosition(vehicleElement, string.gsub(_ARG_0_, "_excomp", ""), "world") + componentOffsets[_ARG_0_][3],
  1223.       getVehicleComponentPosition(vehicleElement, string.gsub(_ARG_0_, "_excomp", ""), "world") + (0 + (componentOffsets[_ARG_0_][4] - 0) * math.cos((math.rad(getElementRotation(vehicleElement)))) - (componentOffsets[_ARG_0_][5] - 0) * math.sin((math.rad(getElementRotation(vehicleElement))))),
  1224.       getVehicleComponentPosition(vehicleElement, string.gsub(_ARG_0_, "_excomp", ""), "world") + (0 + (componentOffsets[_ARG_0_][4] - 0) * math.sin((math.rad(getElementRotation(vehicleElement)))) + (componentOffsets[_ARG_0_][5] - 0) * math.cos((math.rad(getElementRotation(vehicleElement))))),
  1225.       getVehicleComponentPosition(vehicleElement, string.gsub(_ARG_0_, "_excomp", ""), "world") + componentOffsets[_ARG_0_][6]
  1226.     }
  1227.     _UPVALUE6_ = getTickCount()
  1228.     playSound("files/sounds/cammove.mp3")
  1229.     _UPVALUE0_ = _ARG_0_
  1230.   end
  1231. end
  1232. function isCursorWithinArea_Size(_ARG_0_, _ARG_1_, _ARG_2_, _ARG_3_, _ARG_4_, _ARG_5_)
  1233.   return _ARG_2_ <= _ARG_0_ and _ARG_0_ <= _ARG_2_ + _ARG_4_ and _ARG_3_ <= _ARG_1_ and _ARG_1_ <= _ARG_3_ + _ARG_5_
  1234. end
  1235. function getCursorPosition()
  1236.   if isCursorShowing() then
  1237.     return screenWidth * _UPVALUE0_(), screenHeight * _UPVALUE0_()
  1238.   else
  1239.     return 0, 0
  1240.   end
  1241. end
  1242. function thousandsStepper(_ARG_0_)
  1243.   while true do
  1244.     k = string.gsub(_ARG_0_, "^(-?%d+)(%d%d%d)", "%1 %2")
  1245.     if k == 0 then
  1246.       break
  1247.     end
  1248.   end
  1249.   return string.gsub(_ARG_0_, "^(-?%d+)(%d%d%d)", "%1 %2")
  1250. end
  1251. function compareTables(_ARG_0_, _ARG_1_)
  1252.   if #_ARG_0_ ~= #_ARG_1_ then
  1253.     return false
  1254.   end
  1255.   for _FORV_5_ = 1, #_ARG_0_ do
  1256.     if _ARG_0_[_FORV_5_] ~= _ARG_1_[_FORV_5_] then
  1257.       return false
  1258.     end
  1259.   end
  1260.   return _FOR_
  1261. end
Advertisement
Add Comment
Please, Sign In to add comment