Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local thePlayer=getLocalPlayer()
- ----Szerelőhelyek----
- local mechanicPlaces = {
- {2120.0178222656, -2175.5944824219, 13.546875},--1
- {2160.9150390625, -2177.1694335938, 13.546875},--2
- {2151.5458984375, -2187.2780761719, 13.546875},--3
- {2141.24609375, -2196.6135253906, 13.554370880127},--4
- {2170.5786132813, -2167.4587402344, 13.546875},--5
- }
- local mechanicCols = { }
- function createMechanicPlaces()
- for index, value in ipairs(mechanicPlaces) do
- mechanicCols[index] = createColSphere(mechanicPlaces[index][1], mechanicPlaces[index][2], mechanicPlaces[index][3], 5)
- end
- end
- addEventHandler("onClientResourceStart", getResourceRootElement(), createMechanicPlaces)
- local elementtabla={
- {"boot_dummy","csomagtartó"},--1
- {"bonnet_dummy","motorháztető"},--2
- {"door_lf_dummy","bal első ajtó"},--3
- {"door_rf_dummy","jobb első ajtó"},--4
- {"door_lr_dummy","bal hátsó ajtó"},--5
- {"door_rr_dummy","jobb hátsó ajtó"},--6
- {"windscreen_dummy","szélvédő"},--7
- {"bump_front_dummy","első lökhárító"},--8
- {"bump_rear_dummy","hátsó lökhárító"},--9
- {"wheel_rf_dummy","jobb első kerék"},--10
- {"wheel_lf_dummy","bal első kerék"},--11
- {"wheel_rb_dummy","jobb hátsó kerék"},--12
- {"wheel_lb_dummy","bal hátsó kerék"},--13
- }
- ---Sérülések lekérése
- function serulesek()
- for index, v in pairs(mechanicPlaces) do
- if isElementWithinColShape(getLocalPlayer(), mechanicCols[index]) then
- local vehicles = getElementsByType("vehicle",getRootElement(),true)
- for k,v in ipairs(vehicles) do
- local x,y,z = getElementPosition(localPlayer)
- local carX,carY,carZ = getElementPosition(v)
- local gx,gy = guiGetScreenSize()
- local SizeX, SizeY = 200, 30
- if getDistanceBetweenPoints3D(x,y,z,carX,carY,carZ) <= 5 then
- ---Bal első ajtó
- if getVehicleComponentPosition ( v, elementtabla[3][1], "world" ) then
- local x2,y2,z2 = getVehicleComponentPosition ( v, elementtabla[3][1], "world" )
- wx2,wy2,wz2 = getScreenFromWorldPosition ( x2, y2, z2 )
- local doorState2 = getVehicleDoorState(v, 2)
- if doorState2 == 4 or doorState2 == 3 or doorState2 == 2 then
- dxDrawRectangle ( wx2 - SizeX / 2 - 4, wy2 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx2 - SizeX / 2, wy2 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx2 - SizeX / 2, wy2 - SizeY / 2, SizeX, SizeY, wx2color )
- dxDrawText ( "Bal első ajtó", wx2 - SizeX / 2, wy2 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- --Csomagtartó
- if getVehicleComponentPosition ( v, elementtabla[1][1], "world" ) then
- local x1,y1,z1 = getVehicleComponentPosition ( v, elementtabla[1][1], "world" )
- wx1,wy1,wz1 = getScreenFromWorldPosition ( x1, y1, z1 )
- local doorState1 = getVehicleDoorState(v, 1)
- if doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then
- dxDrawRectangle ( wx1 - SizeX / 2 - 4, wy1 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx1 - SizeX / 2, wy1 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx1 - SizeX / 2, wy1 - SizeY / 2, SizeX, SizeY, wx1color )
- dxDrawText ( "Csomagtartó", wx1 - SizeX / 2, wy1 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Motorháztető
- if getVehicleComponentPosition ( v, elementtabla[2][1], "world" ) then
- local x0,y0,z0 = getVehicleComponentPosition ( v, elementtabla[2][1], "world" )
- wx0,wy0,wz0 = getScreenFromWorldPosition ( x0, y0, z0 )
- local doorState1 = getVehicleDoorState(v, 0)
- if doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then
- dxDrawRectangle ( wx0 - SizeX / 2 - 4, wy0 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx0 - SizeX / 2, wy0 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx0 - SizeX / 2, wy0 - SizeY / 2, SizeX, SizeY, wx0color )
- dxDrawText ( "Motorháztető", wx0 - SizeX / 2, wy0 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Jobb első ajtó
- if getVehicleComponentPosition ( v, elementtabla[4][1], "world" ) then
- local x3,y3,z3 = getVehicleComponentPosition ( v, elementtabla[4][1], "world" )
- wx3,wy3,wz3 = getScreenFromWorldPosition ( x3, y3, z3 )
- local doorState1 = getVehicleDoorState(v, 3)
- if doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then
- dxDrawRectangle ( wx3 - SizeX / 2 - 4, wy3 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx3 - SizeX / 2, wy3 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx3 - SizeX / 2, wy3 - SizeY / 2, SizeX, SizeY, wx3color )
- dxDrawText ( "Jobb első ajtó", wx3 - SizeX / 2, wy3 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Bal hátsó ajtó
- if getVehicleComponentPosition ( v, elementtabla[5][1], "world" ) then
- local x4,y4,z4 = getVehicleComponentPosition ( v, elementtabla[5][1], "world" )
- wx4,wy4,wz4 = getScreenFromWorldPosition ( x4, y4, z4 )
- local doorState1 = getVehicleDoorState(v, 4)
- if doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then
- dxDrawRectangle ( wx4 - SizeX / 2 - 4, wy4 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx4 - SizeX / 2, wy4 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx4 - SizeX / 2, wy4 - SizeY / 2, SizeX, SizeY, wx4color )
- dxDrawText ( " Bal hátsó ajtó", wx4 - SizeX / 2, wy4 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Jobb hátsó ajtó
- if getVehicleComponentPosition ( v, elementtabla[6][1], "world" ) then
- local x5,y5,z5 = getVehicleComponentPosition ( v, elementtabla[6][1], "world" )
- wx5,wy5,wz5 = getScreenFromWorldPosition ( x5, y5, z5 )
- local doorState1 = getVehicleDoorState(v, 5)
- if doorState1 == 4 or doorState1 == 3 or doorState1 == 2 then
- dxDrawRectangle ( wx5 - SizeX / 2 - 4, wy5 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx5 - SizeX / 2, wy5 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx5 - SizeX / 2, wy5 - SizeY / 2, SizeX, SizeY, wx5color )
- dxDrawText ( " Jobb hátsó ajtó", wx5 - SizeX / 2, wy5 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Szélvédő
- if getVehicleComponentPosition ( v, elementtabla[7][1], "world" ) then
- local x6,y6,z6 = getVehicleComponentPosition ( v, elementtabla[7][1], "world" )
- wx6,wy6,wz6 = getScreenFromWorldPosition ( x6, y6, z6 )
- local screenState1 = getVehiclePanelState(v, 4)
- if screenState1 == 3 or screenState1 == 2 or screenState1 == 1 then
- dxDrawRectangle ( wx6 - SizeX / 2 - 4, wy6 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx6 - SizeX / 2, wy6 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx6 - SizeX / 2, wy6 - SizeY / 2, SizeX, SizeY, wx6color )
- dxDrawText ( " Szélvédő", wx6 - SizeX / 2, wy6 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Első lökös
- if getVehicleComponentPosition ( v, elementtabla[8][1], "world" ) then
- local x7,y7,z7 = getVehicleComponentPosition ( v, elementtabla[8][1], "world" )
- wx7,wy7,wz7 = getScreenFromWorldPosition ( x7, y7, z7 )
- local elokosState = getVehiclePanelState(v, 5)
- if elokosState == 3 or elokosState == 2 or elokosState == 1 then
- dxDrawRectangle ( wx7 - SizeX / 2 - 4, wy7 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx7 - SizeX / 2, wy7 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx7 - SizeX / 2, wy7 - SizeY / 2, SizeX, SizeY, wx7color )
- dxDrawText ( " Első lökhárító", wx7 - SizeX / 2, wy7 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Hátsó lökös
- if getVehicleComponentPosition ( v, elementtabla[9][1], "world" ) then
- local x8,y8,z8 = getVehicleComponentPosition ( v, elementtabla[9][1], "world" )
- wx8,wy8,wz8 = getScreenFromWorldPosition ( x8, y8, z8 )
- local hlokosState = getVehiclePanelState(v, 6)
- if hlokosState == 3 or hlokosState == 2 or hlokosState == 1 then
- dxDrawRectangle ( wx8 - SizeX / 2 - 4, wy8 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( wx8 - SizeX / 2, wy8 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( wx8 - SizeX / 2, wy8 - SizeY / 2, SizeX, SizeY, wx8color )
- dxDrawText ( " Hátsó lökhárító", wx8 - SizeX / 2, wy8 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Lámpa
- local lampaState0 = getVehicleLightState(v,0)
- local lampaState1 = getVehicleLightState(v,1)
- local lampaState2 = getVehicleLightState(v,2)
- local lampaState3 = getVehicleLightState(v,3)
- if lampaState0 == 1 or lampaState1 == 1 or lampaState2 == 1 or lampaState3 == 1 then
- dxDrawRectangle ( gx/2-4+500,gy/2-4+50, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( gx/2+500,gy/2+50, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( gx/2+500,gy/2+50, SizeX, SizeY, gcx1color )
- dxDrawText ( "Lámpa", gx/2+500,gy/2+50, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- --- Kerekek
- local frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates (v)
- ---Jobb első kerék
- if getVehicleComponentPosition ( v, elementtabla[10][1], "world" ) then
- local x9,y9,z9 = getVehicleComponentPosition ( v, elementtabla[10][1], "world" )
- XX2,YY2 = getScreenFromWorldPosition ( x9, y9, z9 )
- if frontRight == 1 or frontRight == 2 then
- dxDrawRectangle ( XX2 - SizeX / 2 - 4, YY2 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( XX2 - SizeX / 2, YY2 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( XX2 - SizeX / 2, YY2 - SizeY / 2, SizeX, SizeY, XX2color )
- dxDrawText ( " Jobb első kerék", XX2 - SizeX / 2, YY2 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Bal első kerék
- if getVehicleComponentPosition ( v, elementtabla[11][1], "world" ) then
- local x10,y10,z10 = getVehicleComponentPosition ( v, elementtabla[11][1], "world" )
- XX1,YY1 = getScreenFromWorldPosition ( x10, y10, z10 )
- if frontLeft == 1 or frontLeft == 2 then
- dxDrawRectangle ( XX1 - SizeX / 2 - 4, YY1 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( XX1 - SizeX / 2, YY1 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( XX1 - SizeX / 2, YY1 - SizeY / 2, SizeX, SizeY, XX1color )
- dxDrawText ( " Bal első kerék", XX1 - SizeX / 2, YY1 - SizeY / 2, SizeX/2, SizeY/2, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Jobb hátsó kerék
- if getVehicleComponentPosition ( v, elementtabla[12][1], "world" ) then
- local x11,y11,z11 = getVehicleComponentPosition ( v, elementtabla[12][1], "world" )
- XX4,YY4 = getScreenFromWorldPosition ( x11, y11, z11 )
- if rearRight == 1 or rearRight == 2 then
- dxDrawRectangle ( XX4 - SizeX / 2 - 4, YY4 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( XX4 - SizeX / 2, YY4 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( XX4 - SizeX / 2, YY4 - SizeY / 2, SizeX, SizeY, XX4color )
- dxDrawText ( " Jobb hátsó kerék", XX4 - SizeX / 2, YY4 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 1.85, "default-bold" )
- end
- end
- ---Bal hátsó kerék
- if getVehicleComponentPosition ( v, elementtabla[13][1], "world" ) then
- local x12,y12,z12 = getVehicleComponentPosition ( v, elementtabla[13][1], "world" )
- XX3,YY3 = getScreenFromWorldPosition ( x12, y12, z12 )
- if rearLeft == 1 or rearLeft == 2 then
- dxDrawRectangle ( XX3 - SizeX / 2 - 4, YY3 - SizeY / 2 - 4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( XX3 - SizeX / 2, YY3 - SizeY / 2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( XX3 - SizeX / 2, YY3 - SizeY / 2, SizeX, SizeY, XX3color )
- dxDrawText ( " Bal hátsó kerék", XX3 - SizeX / 2, YY3 - SizeY / 2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- end
- ---Motor
- motorelet = getElementHealth (v)
- if motorelet < 600 then
- dxDrawRectangle ( gx/2-4+500,gy/2-4, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( gx/2+500,gy/2, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( gx/2+500,gy/2, SizeX, SizeY, gcx2color )
- dxDrawText ( "Motor", gx/2+500,gy/2, SizeX, SizeY, tocolor(0,0,0), 2, "default-bold" )
- end
- ---Sérülések lezárva---
- ---Dobozszin---
- local sx,sy = guiGetScreenSize()
- local cx,cy = getCursorPosition ()
- local cx,cy = cx*sx,cy*sy
- ---Keréknél----
- ---Bal első kerék
- if getVehicleComponentPosition ( v, elementtabla[11][1], "world" ) then
- cx1=XX1 - SizeX / 2 - 4
- cy1=YY1 - SizeY / 2 - 4
- if cx > cx1 and cy > cy1 and cx < cx1 +200 and cy < cy1 + 30 then
- XX1color = tocolor (255,0,0,200)
- else
- XX1color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Bal hátsó kerék
- if getVehicleComponentPosition ( v, elementtabla[13][1], "world" ) then
- cx3=XX3 - SizeX / 2 - 4
- cy3=YY3 - SizeY / 2 - 4
- if cx > cx3 and cy > cy3 and cx < cx3 +200 and cy < cy3 + 30 then
- XX3color = tocolor (255,0,0,200)
- else
- XX3color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Jobb első kerék
- if getVehicleComponentPosition ( v, elementtabla[10][1], "world" ) then
- cx2=XX2 - SizeX / 2 - 4
- cy2=YY2 - SizeY / 2 - 4
- if cx > cx2 and cy > cy2 and cx < cx2 +200 and cy < cy2 + 30 then
- XX2color = tocolor (255,0,0,200)
- else
- XX2color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Jobb hátsó kerék
- if getVehicleComponentPosition ( v, elementtabla[12][1], "world" ) then
- cx4=XX4 - SizeX / 2 - 4
- cy4=YY4 - SizeY / 2 - 4
- if cx > cx4 and cy > cy4 and cx < cx4 +200 and cy < cy4 + 30 then
- XX4color = tocolor (255,0,0,200)
- else
- XX4color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Kerék lezárva---
- ---Ajtó----
- ---Bal első ajtó
- if getVehicleComponentPosition ( v, elementtabla[3][1], "world" ) then
- wcx2=wx2 - SizeX / 2 - 4
- wcy2=wy2 - SizeY / 2 - 4
- if cx > wcx2 and cy > wcy2 and cx < wcx2 +200 and cy < wcy2 + 30 then
- wx2color = tocolor (255,0,0,200)
- else
- wx2color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Bal hátsó ajtó
- if getVehicleComponentPosition ( v, elementtabla[5][1], "world" ) then
- wcx4=wx4 - SizeX / 2 - 4
- wcy4=wy4 - SizeY / 2 - 4
- if cx > wcx4 and cy > wcy4 and cx < wcx4 +200 and cy < wcy4 + 30 then
- wx4color = tocolor (255,0,0,200)
- else
- wx4color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Jobb első ajtó
- if getVehicleComponentPosition ( v, elementtabla[4][1], "world" ) then
- wcx3=wx3 - SizeX / 2 - 4
- wcy3=wy3 - SizeY / 2 - 4
- if cx > wcx3 and cy > wcy3 and cx < wcx3 +200 and cy < wcy3 + 30 then
- wx3color = tocolor (255,0,0,200)
- else
- wx3color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Jobb hátsó ajtó
- if getVehicleComponentPosition ( v, elementtabla[6][1], "world" ) then
- wcx5=wx5 - SizeX / 2 - 4
- wcy5=wy5 - SizeY / 2 - 4
- if cx > wcx5 and cy > wcy5 and cx < wcx5 +200 and cy < wcy5 + 30 then
- wx5color = tocolor (255,0,0,200)
- else
- wx5color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Ajtók lezárva---
- ---Lökös---
- ---Első lökös
- if getVehicleComponentPosition ( v, elementtabla[8][1], "world" ) then
- wcx7=wx7 - SizeX / 2 - 4
- wcy7=wy7 - SizeY / 2 - 4
- if cx > wcx7 and cy > wcy7 and cx < wcx7 +200 and cy < wcy7 + 30 then
- wx7color = tocolor (255,0,0,200)
- else
- wx7color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Hátsó lökös
- if getVehicleComponentPosition ( v, elementtabla[9][1], "world" ) then
- wcx8=wx8 - SizeX / 2 - 4
- wcy8=wy8 - SizeY / 2 - 4
- if cx > wcx8 and cy > wcy8 and cx < wcx8 +200 and cy < wcy8 + 30 then
- wx8color = tocolor (255,0,0,200)
- else
- wx8color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Lökös lezárva---
- ---Motorháztető---
- if getVehicleComponentPosition ( v, elementtabla[2][1], "world" ) then
- wcx0=wx0 - SizeX / 2 - 4
- wcy0=wy0 - SizeY / 2 - 4
- if cx > wcx0 and cy > wcy0 and cx < wcx0 +200 and cy < wcy0 + 30 then
- wx0color = tocolor (255,0,0,200)
- else
- wx0color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Csomagtartó---
- if getVehicleComponentPosition ( v, elementtabla[1][1], "world" ) then
- wcx1=wx1 - SizeX / 2 - 4
- wcy1=wy1 - SizeY / 2 - 4
- if cx > wcx1 and cy > wcy1 and cx < wcx1 +200 and cy < wcy1 + 30 then
- wx1color = tocolor (255,0,0,200)
- else
- wx1color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Szélvédő---
- if getVehicleComponentPosition ( v, elementtabla[7][1], "world" ) then
- wcx6=wx6 - SizeX / 2 - 4
- wcy6=wy6 - SizeY / 2 - 4
- if cx > wcx6 and cy > wcy6 and cx < wcx6 +200 and cy < wcy6 + 30 then
- wx6color = tocolor (255,0,0,200)
- else
- wx6color = tocolor ( 172, 211, 115, 200 )
- end
- end
- ---Lámpa---
- gcx1=gx/2-4+500
- gcy1=gy/2-4+50
- if cx > gcx1 and cy > gcy1 and cx < gcx1 +200 and cy < gcy1 + 30 then
- gcx1color = tocolor (255,0,0,200)
- else
- gcx1color = tocolor ( 172, 211, 115, 200 )
- end
- ---Motor---
- gcx2=gx/2-4+500
- gcy2=gy/2-4
- if cx > gcx2 and cy > gcy2 and cx < gcx2 +200 and cy < gcy2 + 30 then
- gcx2color = tocolor (255,0,0,200)
- else
- gcx2color = tocolor ( 172, 211, 115, 200 )
- end
- end
- end
- end
- end
- end
- --addEventHandler ( "onClientRender", root, serulesek )
- ----Frakció---
- function frakcio ()
- --if getElementData(localPlayer, "char:dutyfaction") == 11 then
- outputChatBox("dutyba")
- addEventHandler ( "onClientRender", root, serulesek )
- --else
- --outputChatBox("nemduty")
- --removeEventHandler ( "onClientRender", root, serulesek )
- --end
- end
- addCommandHandler("duty",frakcio)
- cr=false
- function cursor ()
- if cr == false then
- showCursor (true)
- cr=true
- elseif cr == true then
- showCursor (false)
- cr=false
- end
- end
- bindKey("m","down",cursor)
- ----Kattintás----
- function klikk (button,state)
- if button == "left" and state == "down" then
- ---if getElementData(localPlayer, "kezben") == false then
- if wx0color == tocolor (255,0,0,200) then --Motorháztető
- outputChatBox("Motorháztető",0,255,0)
- kx,ky,kz,krx,kry,krz = 0, 0.6, 0, 0, 0, 0
- element="bonnet_dummy"
- door=0
- fix ()
- elseif wx1color == tocolor (255,0,0,200) then --Csomagtartó
- outputChatBox("Csomagtartó",0,255,0)
- kx,ky,kz,krx,kry,krz =0, -1.6, 0, 0, 0, 180
- element="boot_dummy"
- door=1
- fix ()
- elseif wx2color == tocolor (255,0,0,200) then --Bal eslő ajtó
- outputChatBox("Bal eslő ajtó",0,255,0)
- kx,ky,kz,krx,kry,krz = 0, 1.56, 0.71, 0, 0, 90
- element="door_lf_dummy"
- door=2
- fix ()
- elseif wx3color == tocolor (255,0,0,200) then --Jobb első ajtó
- outputChatBox("Jobb első ajtó",0,255,0)
- kx,ky,kz,krx,kry,krz = 0, 0.56, 0.71, 0, 0, 90
- element="door_rf_dummy"
- door=3
- fix ()
- elseif wx4color == tocolor (255,0,0,200) then --Bal hátsó ajtó
- outputChatBox("Bal hátsó ajtó",0,255,0)
- kx,ky,kz,krx,kry,krz = -1, 1.56, 0.71, 0, 0, 90
- element="door_lr_dummy"
- door=4
- fix ()
- elseif wx5color == tocolor (255,0,0,200) then --Jobb hátsó ajtó
- outputChatBox("Jobb hátsó ajtó",0,255,0)
- kx,ky,kz,krx,kry,krz = -1, -0.56, 0.71, 0, 0, 90
- element="door_rr_dummy"
- door=5
- fix ()
- elseif wx6color == tocolor (255,0,0,200) then --Szélvédő
- outputChatBox("Szélvédő",0,255,0)
- kx,ky,kz,krx,kry,krz = 0, -0.4, 0.6, -45, 0, 0
- element = "windscreen_dummy"
- panel=4
- fix ()
- elseif wx7color == tocolor (255,0,0,200) then --Első lökös
- outputChatBox("Első lökös",0,255,0)
- kx,ky,kz,krx,kry,krz = 0, 0.4, -2.3, 90, 0, 0
- element = "bump_front_dummy"
- panel=5
- fix ()
- elseif wx8color == tocolor (255,0,0,200) then --Hátsó lökös
- outputChatBox("Hátsó lökös",0,255,0)
- kx,ky,kz,krx,kry,krz = 0, 0.6, -2.3, -90, 0, 0
- element = "bump_rear_dummy"
- panel=6
- fix()
- elseif XX1color == tocolor (255,0,0,200) then --Bal első kerék jó
- outputChatBox("Bal első kerék",0,255,0)
- kx,ky,kz,krx,kry,krz= 1.5,1.2,1,0,0,90
- element="wheel_lf_dummy"
- fix ()
- setElementData(localPlayer, "alkatresz", true)
- elseif XX2color == tocolor (255,0,0,200) then --Jobb első kerék
- outputChatBox("Jobb első kerék",0,255,0)
- kx,ky,kz,krx,kry,krz= -1.5,1.2,1,0,0,90
- element="wheel_rf_dummy"
- fix ()
- setElementData(localPlayer, "alkatresz", true)
- elseif XX3color == tocolor (255,0,0,200) then --Bal hátsó kerék
- outputChatBox("Bal hátsó kerék",0,255,0)
- kx,ky,kz,krx,kry,krz= -1.5,1.2,1,0,0,90
- element="wheel_lb_dummy"
- fix ()
- setElementData(localPlayer, "alkatresz", true)
- elseif XX4color == tocolor (255,0,0,200) then --Jobb hátsó kerék
- frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates (VehicleS)
- outputChatBox("Jobb hátsó kerék",0,255,0)
- kx,ky,kz,krx,kry,krz= 1.5,1.2,1,0,0,-90
- element="wheel_rb_dummy"
- fix ()
- setElementData(localPlayer, "alkatresz", true)
- elseif gcx1color == tocolor (255,0,0,200) then --Lámpa
- setElementData(localPlayer, "alkatresz", true)
- lightfix()
- elseif gcx2color == tocolor (255,0,0,200) then --Motor
- setElementData(localPlayer, "alkatresz", true)
- enginefix()
- end
- --else
- --outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Már a kezedben van egy alkatrész.",255,0,0,true)
- ---end
- end
- end
- addEventHandler ( "onClientClick", getRootElement(),klikk )
- -----Kattintás blokkolása-----
- function clicklock (thePlayer)
- removeEventHandler ( "onClientRender", getRootElement(), serulesek )
- setTimer (function ()
- addEventHandler ( "onClientRender", getRootElement(), serulesek )
- end,10000,1)
- end
- ----Loading csík----
- function loadingstart (thePlayer)
- start = getTickCount()
- addEventHandler ( "onClientRender", getRootElement(), loading )
- end
- addEvent("loadingstart", true)
- addEventHandler("loadingstart", getRootElement(), loadingstart)
- function loading (thePlayer)
- now = getTickCount()
- gx,gy = guiGetScreenSize()
- SizeX, SizeY = 400, 40
- local now = getTickCount()
- local endTime = start + 10000
- local elapsedTime = now - start
- local duration = endTime - start
- local progress = elapsedTime / duration
- dxDrawRectangle ( gx /2 - 4-200, gy /2 - 4+350, SizeX + 8, SizeY + 8, tocolor ( 0, 0, 0, 150) )
- dxDrawRectangle ( gx /2-200, gy /2+350, SizeX, SizeY, tocolor ( 172, 211, 115, 50 ) )
- dxDrawRectangle ( gx /2-200 , gy /2+350, SizeX, SizeY, tocolor ( 172, 211, 115, 200 ) )
- dxDrawRectangle ( gx /2-200 , gy /2+350, toltesfel, SizeY, tocolor ( 255, 0, 0, 200 ) )
- dxDrawText ( szoveg, gx /2-100, gy /2+350, SizeX, SizeY, tocolor(0,0,0), 3, "default-bold" )
- toltesfel=interpolateBetween(0,0,0,400,0,0,progress,"Linear")
- if toltesfel >= SizeX then
- removeEventHandler ( "onClientRender", getRootElement ( ), loading )
- end
- end
- ----Közeli autó lekérése----
- function GetClosestPlayer ( Player )
- local X1, Y1, Z1 = getElementPosition ( Player )
- local Dis = 1000
- local Dis2 = 0
- local Vehicle = -1
- for key, Veh in ipairs ( getElementsByType ( "vehicle" ) ) do
- if Veh ~= Player then
- local X2, Y2, Z2 = getElementPosition ( Veh )
- Dis2 = getDistanceBetweenPoints3D ( X1, Y1, Z1, X2, Y2, Z2 )
- if tonumber ( Dis2 ) < tonumber ( Dis ) then
- Dis = Dis2;
- Vehicle = Veh;
- end
- end
- end
- return Vehicle, Dis
- end
- ----Motorjavítás----
- function enginefix ()
- triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
- triggerServerEvent("animhang",localPlayer,localPlayer)
- loadingstart ()
- clicklock ()
- szoveg= " Javítás"
- setTimer ( function()
- local VehicleS, Tavolsag = GetClosestPlayer ( getLocalPlayer ( ) )
- lampmotor=false
- triggerServerEvent("fixlampmotor",localPlayer,localPlayer,VehicleS,lampmotor)
- end, 10000, 1 )
- end
- -------Lámpajavítás----
- function lightfix ()
- triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
- triggerServerEvent("animhang",localPlayer,localPlayer)
- loadingstart ()
- clicklock ()
- szoveg= " Javítás"
- setTimer ( function()
- local VehicleS, Tavolsag = GetClosestPlayer ( getLocalPlayer ( ) )
- lampmotor=true
- triggerServerEvent("fixlampmotor",localPlayer,localPlayer,VehicleS,lampmotor)
- end, 10000, 1 )
- end
- -----Javítás----
- function fix ()
- VehicleS, Tavolsag = GetClosestPlayer ( getLocalPlayer ( ) )
- carmodel=getElementModel(VehicleS)
- triggerServerEvent("elementdatak",thePlayer,thePlayer,door,panel,carmodel)
- end
- tabla={}
- getComponent={}
- ------leszereljük az alkatrészt--------
- function javitas (thePlayer,clonauto)
- loadingstart (thePlayer)
- clicklock (thePlayer)
- triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
- local frontLeft1, rearLeft1, frontRight1, rearRight1 = getVehicleWheelStates (VehicleS)--balelső,balhátsó,jobbelső,jobbhátsó
- if element=="wheel_lf_dummy" then --bal első
- k1,k2,k3,k4=0,rearLeft1,frontRight1,rearRight1
- elseif element=="wheel_rf_dummy" then -- jobb első
- k1,k2,k3,k4=frontLeft1,rearLeft1,0,rearRight1
- elseif element=="wheel_lb_dummy" then -- bal hátsó
- k1,k2,k3,k4=frontLeft1,0,frontRight1,rearRight1
- elseif element=="wheel_rb_dummy" then -- jobb hátsó
- k1,k2,k3,k4=frontLeft1,rearLeft1,frontRight1,0
- else
- k1,k2,k3,k4=frontLeft1,rearLeft1,frontRight1,rearRight1
- end
- exports.mta_chat:sendLocalMeMessage(localPlayer, "elkezde leszerelni a/az ... .")
- szoveg="Leszerelés"
- table.insert(tabla,clonauto)
- table.insert(tabla,getPlayerSerial(thePlayer))
- table.insert(tabla,VehicleS)
- setTimer (function ()
- for i,v in ipairs (tabla) do
- if v==getPlayerSerial(thePlayer) then
- local car=tabla[i-1]
- triggerServerEvent("kezbenvisz",localPlayer,thePlayer,car,kx,ky,kz,krx,kry,krz)--mindenki láss a akézben az autót
- setTimer(function ()
- clonautolt ()
- end,1000,1)
- local allapot=false --láthatatlan
- triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i+1], element,allapot) --mindeki lássa
- end
- end
- end,10000,1 )
- end
- addEvent("javitas", true)
- addEventHandler("javitas", getRootElement(), javitas)
- ---------autóra visszateszi az alaktrészt-----
- function javitasfel (door,panel)
- for i,v in ipairs (tabla) do
- if v==getPlayerSerial(thePlayer) then
- exports.mta_chat:sendLocalMeMessage(localPlayer, "elkezdte felszerelni a/az ... .")
- szoveg="Felszerelés"
- loadingstart ()
- clicklock ()
- triggerServerEvent("playerAnimationToServer", localPlayer, localPlayer, "BOMBER", "BOM_Plant")
- local allapot=true --látható
- triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i+1], element,allapot) --mindenki lássa
- local delcar=tabla[i-1]
- triggerServerEvent("kezbentorol",localPlayer,thePlayer,delcar)--kitörli a kézből az autót
- triggerServerEvent("fixplayercar",localPlayer,thePlayer,tabla[i+1],k1,k2,k3,k4,door,panel)---megjavítja az alkatrészeket
- table.remove(tabla,i)
- table.remove(tabla,i-1)
- table.remove(tabla,i+1)
- end
- end
- --else
- outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Már van a kezedben egy alkatrész.",255,0,0,true)
- end
- addEvent("javitasfel", true)
- addEventHandler("javitasfel", getRootElement(), javitasfel)
- ----clonautó---------
- function clonautolt ()
- for i,v in ipairs (tabla) do
- if v==getPlayerSerial(thePlayer) then
- for vh in pairs (getVehicleComponents(tabla[i-1])) do
- local allapot=false
- triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i-1], vh,allapot)
- local allapot=true
- triggerServerEvent("player->removeComponentFromVehicle", localPlayer, localPlayer, tabla[i-1], element,allapot)
- end
- end
- end
- end
- ----clientmarker----
- function clientmarker (thePlayer)
- for i,v in ipairs (tabla) do
- if v== getPlayerSerial(thePlayer) then
- setVehicleWheelStates (tabla[i-1],0,0,0,0)
- setVehicleDoorState(tabla[i-1],door,0)
- setVehiclePanelState(tabla[i-1],panel,0)
- outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Sikeresen megjavítottad az alkatrészt.",255,0,0,true)
- end
- end
- end
- addEvent("fixmarker", true)
- addEventHandler("fixmarker", getRootElement(), clientmarker)
- ----bugmarker-----
- function fixclientbug ()
- for i,v in ipairs (tabla)do
- if v== getPlayerSerial(thePlayer) then
- triggerServerEvent("kezbentorol",localPlayer,thePlayer,tabla[i-1])--kitörli a kézből az autót
- table.remove(tabla,i)
- table.remove(tabla,i-1)
- table.remove(tabla,i+1)
- outputChatBox("#ffffff[#1E90FFLezlike #ffffff- #FF9933Szerelő#ffffff] Sikeresen kitörölted a bugos alkatrészt.",255,0,0,true)
- end
- end
- end
- addEvent("bugmarker", true)
- addEventHandler("bugmarker", getRootElement(), fixclientbug)
- function receiveRemove(element, componentName,allapot)---mindenki lássa a componentot
- if element and componentName then
- setVehicleComponentVisible(element, componentName, allapot)
- end
- end
- addEvent("player->removeComponentFromVehicleG", true)
- addEventHandler("player->removeComponentFromVehicleG", root, receiveRemove)
- function fixsound(px,py,pz)---mindenki lássa a componentot
- fixeffect=playSound3D("repair.mp3", px, py, pz, true)
- setTimer ( function()
- stopSound(fixeffect)
- end, 10000, 1 )
- end
- addEvent("fixsound", true)
- addEventHandler("fixsound", root, fixsound)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement