Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.19 KB | None | 0 0
  1. local thePlayer=getLocalPlayer()
  2. ----Szerelőhelyek----
  3. local mechanicPlaces = {
  4.     {2120.0178222656, -2175.5944824219, 13.546875},--1
  5.     {2160.9150390625, -2177.1694335938, 13.546875},--2
  6.     {2151.5458984375, -2187.2780761719, 13.546875},--3
  7.     {2141.24609375, -2196.6135253906, 13.554370880127},--4
  8.     {2170.5786132813, -2167.4587402344, 13.546875},--5
  9. }
  10.  
  11. local mechanicCols = { }
  12.  
  13. function createMechanicPlaces()
  14.     for index, value in ipairs(mechanicPlaces) do
  15.         mechanicCols[index] = createColSphere(mechanicPlaces[index][1], mechanicPlaces[index][2], mechanicPlaces[index][3], 5)
  16.     end
  17. end
  18. addEventHandler("onClientResourceStart", getResourceRootElement(), createMechanicPlaces)
  19. local elementtabla={
  20.     {"boot_dummy","csomagtartó"},--1
  21.     {"bonnet_dummy","motorháztető"},--2
  22.     {"door_lf_dummy","bal első ajtó"},--3
  23.     {"door_rf_dummy","jobb első ajtó"},--4
  24.     {"door_lr_dummy","bal hátsó ajtó"},--5
  25.     {"door_rr_dummy","jobb hátsó ajtó"},--6
  26.     {"windscreen_dummy","szélvédő"},--7
  27.     {"bump_front_dummy","első lökhárító"},--8
  28.     {"bump_rear_dummy","hátsó lökhárító"},--9
  29.     {"wheel_rf_dummy","jobb első kerék"},--10
  30.     {"wheel_lf_dummy","bal első kerék"},--11
  31.     {"wheel_rb_dummy","jobb hátsó kerék"},--12
  32.     {"wheel_lb_dummy","bal hátsó kerék"},--13
  33. }
  34. ---Sérülések lekérése
  35. function serulesek()
  36. for index, v in pairs(mechanicPlaces) do
  37. if isElementWithinColShape(getLocalPlayer(), mechanicCols[index]) then
  38. local vehicles = getElementsByType("vehicle",getRootElement(),true)
  39. for k,v in ipairs(vehicles) do
  40. local x,y,z = getElementPosition(localPlayer)
  41. local carX,carY,carZ = getElementPosition(v)
  42. local gx,gy = guiGetScreenSize()
  43. local SizeX, SizeY = 200, 30
  44. if getDistanceBetweenPoints3D(x,y,z,carX,carY,carZ) <= 5 then
  45. ---Bal első ajtó
  46. if getVehicleComponentPosition ( v, elementtabla[3][1], "world" ) then
  47. local x2,y2,z2 = getVehicleComponentPosition ( v, elementtabla[3][1], "world" )
  48.     wx2,wy2,wz2 = getScreenFromWorldPosition ( x2, y2, z2 )
  49. local doorState2 = getVehicleDoorState(v, 2)
  50.     if  doorState2 == 4 or doorState2 == 3 or doorState2 == 2 then 
  51.         dxDrawRectangle ( wx2 - SizeX / 2 - 4, wy2 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  52.         dxDrawRectangle ( wx2 - SizeX / 2, wy2 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  53.         dxDrawRectangle ( wx2 - SizeX / 2, wy2 - SizeY / 2, SizeX, SizeY, wx2color )
  54.         dxDrawText ( "Bal első ajtó", wx2 - SizeX / 2, wy2 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  55.     end
  56. end
  57. --Csomagtartó
  58. if getVehicleComponentPosition ( v, elementtabla[1][1], "world" ) then
  59. local x1,y1,z1 = getVehicleComponentPosition ( v, elementtabla[1][1], "world" )
  60.     wx1,wy1,wz1 = getScreenFromWorldPosition ( x1, y1, z1 )
  61. local doorState1 = getVehicleDoorState(v, 1)
  62.     if  doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then 
  63.         dxDrawRectangle ( wx1 - SizeX / 2 - 4, wy1 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  64.         dxDrawRectangle ( wx1 - SizeX / 2, wy1 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  65.         dxDrawRectangle ( wx1 - SizeX / 2, wy1 - SizeY / 2, SizeX, SizeY, wx1color )
  66.         dxDrawText ( "Csomagtartó", wx1 - SizeX / 2, wy1 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  67.     end
  68. end
  69. ---Motorháztető
  70. if getVehicleComponentPosition ( v, elementtabla[2][1], "world" ) then
  71. local x0,y0,z0 = getVehicleComponentPosition ( v, elementtabla[2][1], "world" )
  72.     wx0,wy0,wz0 = getScreenFromWorldPosition ( x0, y0, z0 )
  73. local doorState1 = getVehicleDoorState(v, 0)
  74.     if  doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then 
  75.         dxDrawRectangle ( wx0 - SizeX / 2 - 4, wy0 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  76.         dxDrawRectangle ( wx0 - SizeX / 2, wy0 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  77.         dxDrawRectangle ( wx0 - SizeX / 2, wy0 - SizeY / 2, SizeX, SizeY, wx0color )
  78.         dxDrawText ( "Motorháztető", wx0 - SizeX / 2, wy0 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  79.     end
  80. end
  81. ---Jobb első ajtó
  82. if getVehicleComponentPosition ( v, elementtabla[4][1], "world" ) then
  83. local x3,y3,z3 = getVehicleComponentPosition ( v, elementtabla[4][1], "world" )
  84.     wx3,wy3,wz3 = getScreenFromWorldPosition ( x3, y3, z3 )
  85. local doorState1 = getVehicleDoorState(v, 3)
  86.     if  doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then 
  87.         dxDrawRectangle ( wx3 - SizeX / 2 - 4, wy3 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  88.         dxDrawRectangle ( wx3 - SizeX / 2, wy3 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  89.         dxDrawRectangle ( wx3 - SizeX / 2, wy3 - SizeY / 2, SizeX, SizeY, wx3color )
  90.         dxDrawText ( "Jobb első ajtó", wx3 - SizeX / 2, wy3 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  91.     end
  92. end
  93. ---Bal hátsó ajtó
  94. if getVehicleComponentPosition ( v, elementtabla[5][1], "world" ) then
  95. local x4,y4,z4 = getVehicleComponentPosition ( v, elementtabla[5][1], "world" )
  96.     wx4,wy4,wz4 = getScreenFromWorldPosition ( x4, y4, z4 )  
  97. local doorState1 = getVehicleDoorState(v, 4)
  98.     if  doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then 
  99.         dxDrawRectangle ( wx4 - SizeX / 2 - 4, wy4 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  100.         dxDrawRectangle ( wx4 - SizeX / 2, wy4 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  101.         dxDrawRectangle ( wx4 - SizeX / 2, wy4 - SizeY / 2, SizeX, SizeY, wx4color )
  102.         dxDrawText ( " Bal hátsó ajtó", wx4 - SizeX / 2, wy4 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  103.     end
  104. end
  105. ---Jobb hátsó ajtó
  106. if getVehicleComponentPosition ( v, elementtabla[6][1], "world" ) then
  107. local x5,y5,z5 = getVehicleComponentPosition ( v, elementtabla[6][1], "world" )
  108.     wx5,wy5,wz5 = getScreenFromWorldPosition ( x5, y5, z5 )
  109. local doorState1 = getVehicleDoorState(v, 5)
  110.     if  doorState1 == 4 or doorState1 == 3 or doorState1 == 2  then
  111.         dxDrawRectangle ( wx5 - SizeX / 2 - 4, wy5 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  112.         dxDrawRectangle ( wx5 - SizeX / 2, wy5 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  113.         dxDrawRectangle ( wx5 - SizeX / 2, wy5 - SizeY / 2, SizeX, SizeY, wx5color )
  114.         dxDrawText ( " Jobb hátsó ajtó", wx5 - SizeX / 2, wy5 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  115.     end
  116. end
  117. ---Szélvédő
  118. if getVehicleComponentPosition ( v, elementtabla[7][1], "world" ) then
  119. local x6,y6,z6 = getVehicleComponentPosition ( v, elementtabla[7][1], "world" )
  120.     wx6,wy6,wz6 = getScreenFromWorldPosition ( x6, y6, z6 )
  121. local screenState1 = getVehiclePanelState(v, 4)
  122.     if screenState1 == 3 or screenState1 == 2 or screenState1 == 1 then
  123.         dxDrawRectangle ( wx6 - SizeX / 2 - 4, wy6 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  124.         dxDrawRectangle ( wx6 - SizeX / 2, wy6 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  125.         dxDrawRectangle ( wx6 - SizeX / 2, wy6 - SizeY / 2, SizeX, SizeY, wx6color )
  126.         dxDrawText ( "   Szélvédő", wx6 - SizeX / 2, wy6 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  127.     end
  128. end
  129. ---Első lökös
  130. if getVehicleComponentPosition ( v, elementtabla[8][1], "world" ) then
  131. local x7,y7,z7 = getVehicleComponentPosition ( v, elementtabla[8][1], "world" )
  132.     wx7,wy7,wz7 = getScreenFromWorldPosition ( x7, y7, z7 )
  133. local elokosState = getVehiclePanelState(v, 5)
  134.     if elokosState == 3 or elokosState == 2 or elokosState == 1 then
  135.         dxDrawRectangle ( wx7 - SizeX / 2 - 4, wy7 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  136.         dxDrawRectangle ( wx7 - SizeX / 2, wy7 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  137.         dxDrawRectangle ( wx7 - SizeX / 2, wy7 - SizeY / 2, SizeX, SizeY, wx7color )
  138.         dxDrawText ( " Első lökhárító", wx7 - SizeX / 2, wy7 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  139.     end
  140. end
  141. ---Hátsó lökös
  142. if getVehicleComponentPosition ( v, elementtabla[9][1], "world" ) then
  143. local x8,y8,z8 = getVehicleComponentPosition ( v, elementtabla[9][1], "world" )
  144.     wx8,wy8,wz8 = getScreenFromWorldPosition ( x8, y8, z8 )
  145. local hlokosState = getVehiclePanelState(v, 6)
  146.     if hlokosState == 3 or hlokosState == 2 or hlokosState == 1 then
  147.         dxDrawRectangle ( wx8 - SizeX / 2 - 4, wy8 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  148.         dxDrawRectangle ( wx8 - SizeX / 2, wy8 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  149.         dxDrawRectangle ( wx8 - SizeX / 2, wy8 - SizeY / 2, SizeX, SizeY, wx8color )
  150.         dxDrawText ( " Hátsó lökhárító", wx8 - SizeX / 2, wy8 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  151.     end
  152. end
  153. ---Lámpa
  154. local lampaState0 = getVehicleLightState(v,0)
  155. local lampaState1 = getVehicleLightState(v,1)
  156. local lampaState2 = getVehicleLightState(v,2)
  157. local lampaState3 = getVehicleLightState(v,3)
  158.     if lampaState0 == 1 or lampaState1 == 1 or lampaState2 == 1 or lampaState3 == 1 then
  159.         dxDrawRectangle ( gx/2-4+500,gy/2-4+50, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  160.         dxDrawRectangle ( gx/2+500,gy/2+50, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  161.         dxDrawRectangle ( gx/2+500,gy/2+50, SizeX, SizeY, gcx1color )
  162.         dxDrawText ( "Lámpa", gx/2+500,gy/2+50, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" ) 
  163.     end
  164. --- Kerekek
  165. local frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates (v)
  166. ---Jobb első kerék
  167. if getVehicleComponentPosition ( v, elementtabla[10][1], "world" ) then
  168. local x9,y9,z9 = getVehicleComponentPosition ( v, elementtabla[10][1], "world" )
  169.     XX2,YY2 = getScreenFromWorldPosition ( x9, y9, z9 )
  170.     if frontRight == 1 or frontRight == 2 then
  171.         dxDrawRectangle ( XX2 - SizeX / 2 - 4, YY2 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  172.         dxDrawRectangle ( XX2 - SizeX / 2, YY2 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  173.         dxDrawRectangle ( XX2 - SizeX / 2, YY2 - SizeY / 2, SizeX, SizeY, XX2color )
  174.         dxDrawText ( " Jobb első kerék", XX2 - SizeX / 2, YY2 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  175.     end
  176. end
  177. ---Bal első kerék
  178. if getVehicleComponentPosition ( v, elementtabla[11][1], "world" ) then
  179. local x10,y10,z10 = getVehicleComponentPosition ( v, elementtabla[11][1], "world" )
  180.     XX1,YY1 = getScreenFromWorldPosition ( x10, y10, z10 )
  181.     if frontLeft == 1 or frontLeft == 2 then
  182.         dxDrawRectangle ( XX1 - SizeX / 2 - 4, YY1 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  183.         dxDrawRectangle ( XX1 - SizeX / 2, YY1 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  184.         dxDrawRectangle ( XX1 - SizeX / 2, YY1 - SizeY / 2, SizeX, SizeY, XX1color )
  185.         dxDrawText ( "  Bal első kerék", XX1 - SizeX / 2, YY1 - SizeY / 2, SizeX/2, SizeY/2, tocolor(0,0,0), 2, "default-bold" )
  186.     end
  187. end
  188. ---Jobb hátsó kerék
  189. if getVehicleComponentPosition ( v, elementtabla[12][1], "world" ) then
  190. local x11,y11,z11 = getVehicleComponentPosition ( v, elementtabla[12][1], "world" )
  191.     XX4,YY4 = getScreenFromWorldPosition ( x11, y11, z11 )
  192.     if rearRight == 1 or rearRight == 2 then
  193.         dxDrawRectangle ( XX4 - SizeX / 2 - 4, YY4 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  194.         dxDrawRectangle ( XX4 - SizeX / 2, YY4 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  195.         dxDrawRectangle ( XX4 - SizeX / 2, YY4 - SizeY / 2, SizeX, SizeY, XX4color )
  196.         dxDrawText ( " Jobb hátsó kerék", XX4 - SizeX / 2, YY4 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 1.85, "default-bold" )
  197.     end
  198. end
  199. ---Bal hátsó kerék
  200. if getVehicleComponentPosition ( v, elementtabla[13][1], "world" ) then
  201. local x12,y12,z12 = getVehicleComponentPosition ( v, elementtabla[13][1], "world" )
  202.     XX3,YY3 = getScreenFromWorldPosition ( x12, y12, z12 )
  203.     if rearLeft == 1 or rearLeft == 2 then
  204.         dxDrawRectangle ( XX3 - SizeX / 2 - 4, YY3 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  205.         dxDrawRectangle ( XX3 - SizeX / 2, YY3 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  206.         dxDrawRectangle ( XX3 - SizeX / 2, YY3 - SizeY / 2, SizeX, SizeY, XX3color )
  207.         dxDrawText ( " Bal hátsó kerék", XX3 - SizeX / 2, YY3 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  208.     end
  209. end
  210. ---Motor
  211. motorelet = getElementHealth (v)
  212.     if motorelet < 600 then
  213.         dxDrawRectangle ( gx/2-4+500,gy/2-4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  214.         dxDrawRectangle ( gx/2+500,gy/2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  215.         dxDrawRectangle ( gx/2+500,gy/2, SizeX, SizeY, gcx2color )
  216.         dxDrawText ( "Motor", gx/2+500,gy/2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
  217.     end
  218. ---Sérülések lezárva---
  219. ---Dobozszin---
  220. local sx,sy = guiGetScreenSize()
  221. local cx,cy = getCursorPosition ()
  222. local cx,cy = cx*sx,cy*sy
  223.     ---Keréknél----
  224.     ---Bal első kerék
  225. if getVehicleComponentPosition ( v, elementtabla[11][1], "world" ) then
  226.     cx1=XX1 - SizeX / 2 - 4
  227.     cy1=YY1 - SizeY / 2 - 4
  228.     if cx > cx1 and cy > cy1 and cx < cx1 +200 and cy < cy1 + 30 then
  229.     XX1color = tocolor (255,0,0,200)
  230.     else
  231.     XX1color = tocolor ( 172, 211, 115, 200 )
  232.     end
  233. end
  234.     ---Bal hátsó kerék
  235. if getVehicleComponentPosition ( v, elementtabla[13][1], "world" ) then
  236.     cx3=XX3 - SizeX / 2 - 4
  237.     cy3=YY3 - SizeY / 2 - 4
  238.     if cx > cx3 and cy > cy3 and cx < cx3 +200 and cy < cy3 + 30 then
  239.     XX3color = tocolor (255,0,0,200)
  240.     else
  241.     XX3color = tocolor ( 172, 211, 115, 200 )
  242.     end
  243. end
  244.     ---Jobb első kerék
  245. if getVehicleComponentPosition ( v, elementtabla[10][1], "world" ) then
  246.     cx2=XX2 - SizeX / 2 - 4
  247.     cy2=YY2 - SizeY / 2 - 4
  248.     if cx > cx2 and cy > cy2 and cx < cx2 +200 and cy < cy2 + 30 then
  249.     XX2color = tocolor (255,0,0,200)
  250.     else
  251.     XX2color = tocolor ( 172, 211, 115, 200 )
  252.     end
  253. end
  254.     ---Jobb hátsó kerék
  255. if getVehicleComponentPosition ( v, elementtabla[12][1], "world" ) then
  256.     cx4=XX4 - SizeX / 2 - 4
  257.     cy4=YY4 - SizeY / 2 - 4
  258.     if cx > cx4 and cy > cy4 and cx < cx4 +200 and cy < cy4 + 30 then
  259.     XX4color = tocolor (255,0,0,200)
  260.     else
  261.     XX4color = tocolor ( 172, 211, 115, 200 )
  262.     end
  263. end
  264.     ---Kerék lezárva---
  265.     ---Ajtó----
  266.     ---Bal első ajtó
  267. if getVehicleComponentPosition ( v, elementtabla[3][1], "world" ) then
  268.     wcx2=wx2 - SizeX / 2 - 4
  269.     wcy2=wy2 - SizeY / 2 - 4   
  270.     if cx > wcx2 and cy > wcy2 and cx < wcx2 +200 and cy < wcy2 + 30 then
  271.     wx2color = tocolor (255,0,0,200)
  272.     else
  273.     wx2color = tocolor ( 172, 211, 115, 200 )
  274.     end
  275. end
  276.     ---Bal hátsó ajtó
  277. if getVehicleComponentPosition ( v, elementtabla[5][1], "world" ) then
  278.     wcx4=wx4 - SizeX / 2 - 4
  279.     wcy4=wy4 - SizeY / 2 - 4
  280.     if cx > wcx4 and cy > wcy4 and cx < wcx4 +200 and cy < wcy4 + 30 then
  281.     wx4color = tocolor (255,0,0,200)
  282.     else
  283.     wx4color = tocolor ( 172, 211, 115, 200 )
  284.     end
  285. end
  286.     ---Jobb első ajtó
  287. if getVehicleComponentPosition ( v, elementtabla[4][1], "world" ) then
  288.     wcx3=wx3 - SizeX / 2 - 4
  289.     wcy3=wy3 - SizeY / 2 - 4   
  290.     if cx > wcx3 and cy > wcy3 and cx < wcx3 +200 and cy < wcy3 + 30 then
  291.     wx3color = tocolor (255,0,0,200)
  292.     else
  293.     wx3color = tocolor ( 172, 211, 115, 200 )
  294.     end
  295. end
  296.     ---Jobb hátsó ajtó
  297. if getVehicleComponentPosition ( v, elementtabla[6][1], "world" ) then
  298.     wcx5=wx5 - SizeX / 2 - 4
  299.     wcy5=wy5 - SizeY / 2 - 4   
  300.     if cx > wcx5 and cy > wcy5 and cx < wcx5 +200 and cy < wcy5 + 30 then
  301.     wx5color = tocolor (255,0,0,200)
  302.     else
  303.     wx5color = tocolor ( 172, 211, 115, 200 )
  304.     end
  305. end
  306.     ---Ajtók lezárva---
  307.     ---Lökös---
  308.     ---Első lökös
  309. if getVehicleComponentPosition ( v, elementtabla[8][1], "world" ) then
  310.     wcx7=wx7 - SizeX / 2 - 4
  311.     wcy7=wy7 - SizeY / 2 - 4   
  312.     if cx > wcx7 and cy > wcy7 and cx < wcx7 +200 and cy < wcy7 + 30 then
  313.     wx7color = tocolor (255,0,0,200)
  314.     else
  315.     wx7color = tocolor ( 172, 211, 115, 200 )
  316.     end
  317. end
  318.     ---Hátsó lökös
  319. if getVehicleComponentPosition ( v, elementtabla[9][1], "world" ) then
  320.     wcx8=wx8 - SizeX / 2 - 4
  321.     wcy8=wy8 - SizeY / 2 - 4   
  322.     if cx > wcx8 and cy > wcy8 and cx < wcx8 +200 and cy < wcy8 + 30 then
  323.     wx8color = tocolor (255,0,0,200)
  324.     else
  325.     wx8color = tocolor ( 172, 211, 115, 200 )
  326.     end
  327. end
  328.     ---Lökös lezárva---
  329.     ---Motorháztető---
  330. if getVehicleComponentPosition ( v, elementtabla[2][1], "world" ) then
  331.     wcx0=wx0 - SizeX / 2 - 4
  332.     wcy0=wy0 - SizeY / 2 - 4   
  333.     if cx > wcx0 and cy > wcy0 and cx < wcx0 +200 and cy < wcy0 + 30 then
  334.     wx0color = tocolor (255,0,0,200)
  335.     else
  336.     wx0color = tocolor ( 172, 211, 115, 200 )
  337.     end
  338. end
  339.     ---Csomagtartó---
  340. if getVehicleComponentPosition ( v, elementtabla[1][1], "world" ) then
  341.     wcx1=wx1 - SizeX / 2 - 4
  342.     wcy1=wy1 - SizeY / 2 - 4   
  343.     if cx > wcx1 and cy > wcy1 and cx < wcx1 +200 and cy < wcy1 + 30 then
  344.     wx1color = tocolor (255,0,0,200)
  345.     else
  346.     wx1color = tocolor ( 172, 211, 115, 200 )
  347.     end
  348. end
  349.     ---Szélvédő---
  350. if getVehicleComponentPosition ( v, elementtabla[7][1], "world" ) then
  351.     wcx6=wx6 - SizeX / 2 - 4
  352.     wcy6=wy6 - SizeY / 2 - 4   
  353.     if cx > wcx6 and cy > wcy6 and cx < wcx6 +200 and cy < wcy6 + 30 then
  354.     wx6color = tocolor (255,0,0,200)
  355.     else
  356.     wx6color = tocolor ( 172, 211, 115, 200 )
  357.     end
  358. end
  359.     ---Lámpa---
  360.     gcx1=gx/2-4+500
  361.     gcy1=gy/2-4+50
  362.     if cx > gcx1 and cy > gcy1 and cx < gcx1 +200 and cy < gcy1 + 30 then
  363.     gcx1color = tocolor (255,0,0,200)
  364.     else
  365.     gcx1color = tocolor ( 172, 211, 115, 200 )
  366.     end
  367.     ---Motor---
  368.     gcx2=gx/2-4+500
  369.     gcy2=gy/2-4
  370.     if cx > gcx2 and cy > gcy2 and cx < gcx2 +200 and cy < gcy2 + 30 then
  371.     gcx2color = tocolor (255,0,0,200)
  372.     else
  373.     gcx2color = tocolor ( 172, 211, 115, 200 )
  374.     end
  375. end
  376. end
  377. end
  378. end
  379. end
  380. --addEventHandler ( "onClientRender", root, serulesek )
  381. ----Frakció---
  382. function frakcio ()
  383.     --if getElementData(localPlayer, "char:dutyfaction") == 11 then
  384.     outputChatBox("dutyba")
  385.     addEventHandler ( "onClientRender", root, serulesek )
  386.     --else
  387.     --outputChatBox("nemduty")
  388.     --removeEventHandler ( "onClientRender", root, serulesek )
  389.     --end
  390. end
  391. addCommandHandler("duty",frakcio)
  392. cr=false
  393. function cursor ()
  394. if cr == false then
  395. showCursor (true)
  396. cr=true
  397. elseif cr == true then  
  398. showCursor (false)
  399. cr=false
  400. end
  401. end
  402. bindKey("m","down",cursor)
  403. ----Kattintás----
  404. function klikk (button,state)
  405.     if button == "left" and state == "down" then
  406.         ---if getElementData(localPlayer, "kezben") == false then
  407.             if wx0color == tocolor (255,0,0,200) then --Motorháztető
  408.                 outputChatBox("Motorháztető",0,255,0)
  409.                 kx,ky,kz,krx,kry,krz = 0, 0.6, 0, 0, 0, 0
  410.                 element="bonnet_dummy"
  411.                 door=0
  412.                 fix ()
  413.             elseif wx1color == tocolor (255,0,0,200) then --Csomagtartó
  414.                 outputChatBox("Csomagtartó",0,255,0)
  415.                 kx,ky,kz,krx,kry,krz =0, -1.6, 0, 0, 0, 180
  416.                 element="boot_dummy"
  417.                 door=1
  418.                 fix ()
  419.             elseif wx2color == tocolor (255,0,0,200) then --Bal eslő ajtó
  420.                 outputChatBox("Bal eslő ajtó",0,255,0)
  421.                 kx,ky,kz,krx,kry,krz = 0, 1.56, 0.71, 0, 0, 90
  422.                 element="door_lf_dummy"
  423.                 door=2
  424.                 fix ()
  425.             elseif wx3color == tocolor (255,0,0,200) then --Jobb első ajtó
  426.                 outputChatBox("Jobb első ajtó",0,255,0)
  427.                 kx,ky,kz,krx,kry,krz = 0, 0.56, 0.71, 0, 0, 90
  428.                 element="door_rf_dummy"
  429.                 door=3
  430.                 fix ()
  431.             elseif wx4color == tocolor (255,0,0,200) then --Bal hátsó ajtó
  432.                 outputChatBox("Bal hátsó ajtó",0,255,0)
  433.                 kx,ky,kz,krx,kry,krz = -1, 1.56, 0.71, 0, 0, 90
  434.                 element="door_lr_dummy"
  435.                 door=4
  436.                 fix ()
  437.             elseif wx5color == tocolor (255,0,0,200) then --Jobb hátsó ajtó
  438.                 outputChatBox("Jobb hátsó ajtó",0,255,0)
  439.                 kx,ky,kz,krx,kry,krz = -1, -0.56, 0.71, 0, 0, 90
  440.                 element="door_rr_dummy"
  441.                 door=5
  442.                 fix ()
  443.             elseif wx6color == tocolor (255,0,0,200) then --Szélvédő
  444.                 outputChatBox("Szélvédő",0,255,0)
  445.                 kx,ky,kz,krx,kry,krz = 0, -0.4, 0.6, -45, 0, 0
  446.                 element = "windscreen_dummy"
  447.                 panel=4
  448.                 fix ()
  449.             elseif wx7color == tocolor (255,0,0,200) then --Első lökös
  450.                 outputChatBox("Első lökös",0,255,0)
  451.                 kx,ky,kz,krx,kry,krz = 0, 0.4, -2.3, 90, 0, 0
  452.                 element = "bump_front_dummy"
  453.                 panel=5
  454.                 fix ()
  455.             elseif wx8color == tocolor (255,0,0,200) then --Hátsó lökös
  456.                 outputChatBox("Hátsó lökös",0,255,0)
  457.                 kx,ky,kz,krx,kry,krz = 0, 0.6, -2.3, -90, 0, 0
  458.                 element = "bump_rear_dummy"
  459.                 panel=6
  460.                 fix()
  461.             elseif XX1color == tocolor (255,0,0,200) then --Bal első kerék jó
  462.                 outputChatBox("Bal első kerék",0,255,0)
  463.                 kx,ky,kz,krx,kry,krz= 1.5,1.2,1,0,0,90
  464.                 element="wheel_lf_dummy"
  465.                 fix ()
  466.                 setElementData(localPlayer, "alkatresz", true)
  467.             elseif XX2color == tocolor (255,0,0,200) then --Jobb első kerék
  468.                 outputChatBox("Jobb első kerék",0,255,0)
  469.                 kx,ky,kz,krx,kry,krz= -1.5,1.2,1,0,0,90
  470.                 element="wheel_rf_dummy"
  471.                 fix ()
  472.                 setElementData(localPlayer, "alkatresz", true)
  473.             elseif XX3color == tocolor (255,0,0,200) then --Bal hátsó kerék
  474.                 outputChatBox("Bal hátsó kerék",0,255,0)
  475.                 kx,ky,kz,krx,kry,krz= -1.5,1.2,1,0,0,90
  476.                 element="wheel_lb_dummy"
  477.                 fix ()
  478.                 setElementData(localPlayer, "alkatresz", true)
  479.             elseif XX4color == tocolor (255,0,0,200) then --Jobb hátsó kerék
  480.                 frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates (VehicleS)
  481.                 outputChatBox("Jobb hátsó kerék",0,255,0)
  482.                 kx,ky,kz,krx,kry,krz= 1.5,1.2,1,0,0,-90
  483.                 element="wheel_rb_dummy"
  484.                 fix ()
  485.                 setElementData(localPlayer, "alkatresz", true)
  486.             elseif gcx1color == tocolor (255,0,0,200) then --Lámpa
  487.                 setElementData(localPlayer, "alkatresz", true)
  488.                 lightfix()
  489.             elseif gcx2color == tocolor (255,0,0,200) then --Motor
  490.                 setElementData(localPlayer, "alkatresz", true)
  491.                 enginefix()
  492.             end
  493.         --else
  494.             --outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Már a kezedben van egy alkatrész.",255,0,0,true)
  495.         ---end
  496.     end
  497. end
  498. addEventHandler ( "onClientClick", getRootElement(),klikk )
  499.  
  500. -----Kattintás blokkolása-----
  501. function clicklock (thePlayer)
  502. removeEventHandler ( "onClientRender", getRootElement(), serulesek )
  503. setTimer (function ()
  504. addEventHandler ( "onClientRender", getRootElement(), serulesek )
  505. end,10000,1)
  506. end
  507. ----Loading csík----
  508. function loadingstart (thePlayer)
  509. start = getTickCount()
  510. addEventHandler ( "onClientRender", getRootElement(), loading )
  511. end
  512. addEvent("loadingstart", true)
  513. addEventHandler("loadingstart", getRootElement(), loadingstart)
  514. function loading (thePlayer)
  515. now = getTickCount()
  516. gx,gy = guiGetScreenSize()
  517. SizeX, SizeY = 400, 40
  518.     local now = getTickCount()
  519.     local endTime = start + 10000
  520.     local elapsedTime = now - start
  521.     local duration = endTime - start
  522.     local progress = elapsedTime / duration
  523.     dxDrawRectangle ( gx /2 - 4-200, gy /2 - 4+350, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
  524.     dxDrawRectangle ( gx /2-200, gy /2+350, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
  525.     dxDrawRectangle ( gx /2-200 , gy /2+350, SizeX, SizeY, tocolor ( 172, 211, 115, 200 ) )
  526.     dxDrawRectangle ( gx /2-200 , gy /2+350, toltesfel, SizeY, tocolor ( 255, 0, 0, 200 ) )
  527.     dxDrawText ( szoveg, gx /2-100, gy /2+350, SizeX, SizeY, tocolor(0,0,0), 3, "default-bold" )
  528.     toltesfel=interpolateBetween(0,0,0,400,0,0,progress,"Linear")
  529.     if toltesfel >= SizeX then
  530.     removeEventHandler ( "onClientRender", getRootElement ( ), loading )
  531.     end
  532. end
  533. ----Közeli autó lekérése----
  534. function GetClosestPlayer ( Player )
  535.     local X1, Y1, Z1 = getElementPosition ( Player )
  536.     local Dis = 1000
  537.     local Dis2 = 0
  538.     local Vehicle = -1
  539.  
  540.     for key, Veh in ipairs ( getElementsByType ( "vehicle" ) ) do
  541.         if Veh ~= Player then
  542.             local X2, Y2, Z2 = getElementPosition ( Veh )
  543.            
  544.             Dis2 = getDistanceBetweenPoints3D ( X1, Y1, Z1, X2, Y2, Z2 )
  545.            
  546.             if tonumber ( Dis2 ) < tonumber ( Dis )  then
  547.                 Dis = Dis2;
  548.                 Vehicle = Veh;
  549.             end
  550.         end
  551.     end
  552.     return Vehicle, Dis
  553. end
  554. ----Motorjavítás----
  555. function enginefix ()
  556. triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
  557. triggerServerEvent("animhang",localPlayer,localPlayer)
  558. loadingstart ()
  559. clicklock ()
  560. szoveg= "   Javítás"
  561. setTimer ( function()
  562. local VehicleS, Tavolsag = GetClosestPlayer ( getLocalPlayer ( ) )
  563. lampmotor=false
  564. triggerServerEvent("fixlampmotor",localPlayer,localPlayer,VehicleS,lampmotor)
  565. end, 10000, 1 )
  566. end
  567. -------Lámpajavítás----
  568. function lightfix ()
  569. triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
  570. triggerServerEvent("animhang",localPlayer,localPlayer)
  571. loadingstart ()
  572. clicklock ()
  573. szoveg= "   Javítás"
  574. setTimer ( function()
  575. local VehicleS, Tavolsag = GetClosestPlayer ( getLocalPlayer ( ) )
  576. lampmotor=true
  577. triggerServerEvent("fixlampmotor",localPlayer,localPlayer,VehicleS,lampmotor)
  578. end, 10000, 1 )
  579. end
  580. -----Javítás----
  581. function fix ()
  582. VehicleS, Tavolsag = GetClosestPlayer ( getLocalPlayer ( ) )
  583. carmodel=getElementModel(VehicleS)
  584. triggerServerEvent("elementdatak",thePlayer,thePlayer,door,panel,carmodel)
  585. end
  586. tabla={}
  587. getComponent={}
  588. ------leszereljük az alkatrészt--------
  589. function javitas (thePlayer,clonauto)
  590. loadingstart (thePlayer)
  591. clicklock (thePlayer)
  592. triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
  593. local frontLeft1, rearLeft1, frontRight1, rearRight1 = getVehicleWheelStates (VehicleS)--balelső,balhátsó,jobbelső,jobbhátsó
  594.     if element=="wheel_lf_dummy" then --bal első
  595.         k1,k2,k3,k4=0,rearLeft1,frontRight1,rearRight1
  596.     elseif element=="wheel_rf_dummy" then -- jobb első
  597.         k1,k2,k3,k4=frontLeft1,rearLeft1,0,rearRight1
  598.     elseif element=="wheel_lb_dummy" then -- bal hátsó
  599.         k1,k2,k3,k4=frontLeft1,0,frontRight1,rearRight1
  600.     elseif element=="wheel_rb_dummy" then -- jobb hátsó
  601.         k1,k2,k3,k4=frontLeft1,rearLeft1,frontRight1,0
  602.     else
  603.         k1,k2,k3,k4=frontLeft1,rearLeft1,frontRight1,rearRight1
  604.     end
  605.     exports.mta_chat:sendLocalMeMessage(localPlayer, "elkezde leszerelni a/az ... .")
  606.     szoveg="Leszerelés"
  607.     table.insert(tabla,clonauto)
  608.     table.insert(tabla,getPlayerSerial(thePlayer))
  609.     table.insert(tabla,VehicleS)
  610.     setTimer (function ()
  611.         for i,v in ipairs (tabla) do
  612.             if v==getPlayerSerial(thePlayer) then
  613.                 local car=tabla[i-1]
  614.                 triggerServerEvent("kezbenvisz",localPlayer,thePlayer,car,kx,ky,kz,krx,kry,krz)--mindenki láss a akézben az autót
  615.                 setTimer(function ()
  616.                     clonautolt ()
  617.                 end,1000,1)
  618.                 local allapot=false --láthatatlan
  619.                 triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i+1], element,allapot) --mindeki lássa  
  620.             end
  621.         end
  622.     end,10000,1 )
  623. end
  624. addEvent("javitas", true)
  625. addEventHandler("javitas", getRootElement(), javitas)
  626. ---------autóra visszateszi az alaktrészt-----
  627. function javitasfel (door,panel)
  628.     for i,v in ipairs (tabla) do
  629.         if v==getPlayerSerial(thePlayer) then
  630.         exports.mta_chat:sendLocalMeMessage(localPlayer, "elkezdte felszerelni a/az ... .")
  631.         szoveg="Felszerelés"
  632.         loadingstart ()
  633.         clicklock ()
  634.         triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
  635.         local allapot=true --látható
  636.         triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i+1], element,allapot) --mindenki lássa
  637.         local delcar=tabla[i-1]
  638.         triggerServerEvent("kezbentorol",localPlayer,thePlayer,delcar)--kitörli a kézből az autót
  639.         triggerServerEvent("fixplayercar",localPlayer,thePlayer,tabla[i+1],k1,k2,k3,k4,door,panel)---megjavítja az alkatrészeket
  640.         table.remove(tabla,i)
  641.         table.remove(tabla,i-1)
  642.         table.remove(tabla,i+1)
  643.         end
  644.     end
  645. --else
  646. outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Már van a kezedben egy alkatrész.",255,0,0,true)
  647. end
  648. addEvent("javitasfel", true)
  649. addEventHandler("javitasfel", getRootElement(), javitasfel)
  650. ----clonautó---------
  651. function clonautolt ()
  652. for i,v in ipairs (tabla) do
  653.     if v==getPlayerSerial(thePlayer) then
  654.     for vh in pairs (getVehicleComponents(tabla[i-1])) do
  655.         local allapot=false
  656.         triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i-1], vh,allapot)
  657.         local allapot=true
  658.         triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i-1], element,allapot)
  659.     end
  660.     end
  661. end
  662. end
  663. ----clientmarker----
  664. function clientmarker (thePlayer)
  665.     for i,v in ipairs (tabla) do
  666.         if v== getPlayerSerial(thePlayer) then
  667.         setVehicleWheelStates (tabla[i-1],0,0,0,0)
  668.         setVehicleDoorState(tabla[i-1],door,0)
  669.         setVehiclePanelState(tabla[i-1],panel,0)
  670.         outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Sikeresen megjavítottad az alkatrészt.",255,0,0,true)
  671.         end
  672.     end
  673. end
  674. addEvent("fixmarker", true)
  675. addEventHandler("fixmarker", getRootElement(), clientmarker)
  676. ----bugmarker-----
  677. function fixclientbug ()
  678.     for i,v in ipairs (tabla)do
  679.         if v== getPlayerSerial(thePlayer) then
  680.             triggerServerEvent("kezbentorol",localPlayer,thePlayer,tabla[i-1])--kitörli a kézből az autót
  681.             table.remove(tabla,i)
  682.             table.remove(tabla,i-1)
  683.             table.remove(tabla,i+1)
  684.             outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Sikeresen kitörölted a bugos alkatrészt.",255,0,0,true)
  685.         end
  686.     end
  687. end
  688. addEvent("bugmarker", true)
  689. addEventHandler("bugmarker", getRootElement(), fixclientbug)
  690.  
  691. function receiveRemove(element, componentName,allapot)---mindenki lássa a componentot
  692.     if element and componentName then
  693.         setVehicleComponentVisible(element, componentName, allapot)
  694.     end
  695. end
  696. addEvent("player->removeComponentFromVehicleG", true)
  697. addEventHandler("player->removeComponentFromVehicleG", root, receiveRemove)
  698.  
  699. function fixsound(px,py,pz)---mindenki lássa a componentot
  700. fixeffect=playSound3D("repair.mp3", px, py, pz, true)
  701. setTimer ( function()
  702.     stopSound(fixeffect)
  703. end, 10000, 1 )
  704. end
  705. addEvent("fixsound", true)
  706. addEventHandler("fixsound", root, fixsound)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement