Jump to content

MTA[DayZ] - Car Parts


India

Recommended Posts

 

V9EVyR.png

I can't see "Fuel" type, can anyone help me?, I'm sorry if I made a mistake, I am new here.

 

SurvivorSystem_client.lua;

 

--Vehicle Infos
    local veh = getPedOccupiedVehicle (getLocalPlayer())
    if veh then
        local maxfuel = getElementData(veh,"maxfuel")
        local fuel = getElementData(getElementData(veh,"parent"),"fuel")
        local needengine = (getElementData(veh,"needengines") or 1)
        local needtires = (getElementData(veh,"needtires") or 4)
        local needparts = (getElementData(veh,"needparts") or 1)
        local engine = getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0
        local tires = getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0
        local parts = getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0
        local offset = dxGetFontHeight(1.02,"default-bold")
        local w = dxGetTextWidth(engine.."/"..needengine.." Engine",1.02,"default-bold")
        if engine == needengine then
            r,g,b = 0,255,0
        else
            r,g,b = 255,0,0
        end
        dxDrawText (engine.."/"..needengine.." Engine" ,screenWidth*0.5-w/2 , screenHeight*0,screenWidth*0.5-w/2 , screenHeight*0,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
        local w = dxGetTextWidth(tires.."/"..needtires.." Tires",1.02,"default-bold")
        if tires == needtires then
            r,g,b = 0,255,0
        else
            r,g,b = 255,0,0
        end
        dxDrawText (tires.."/"..needtires.." Tires",screenWidth*0.5-w/2 , screenHeight*0+offset,screenWidth*0.5-w/2 , screenHeight*0+offset,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
        local w = dxGetTextWidth(parts.."/"..needparts.." Tank Parts",1.02,"default-bold")
        if parts == needparts then
            r,g,b = 0,255,0
        else
            r,g,b = 255,0,0
        end
        dxDrawText (parts.."/"..needparts.." Tank Parts" ,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
      local w = dxGetTextWidth("Fuel:"..math.floor(fuel).."/90"..maxfuel,1.02,"default-bold")
      if fuel == maxfuel then
         r,g,b = 0,255,0
      elseif fuel < maxfuel/10 then
         r,g,b = 255,0,0   
      elseif fuel < maxfuel/4 then
         r,g,b = 255,50,0   
      elseif fuel < maxfuel/3 then
         r,g,b = 200,100,0
      elseif fuel < maxfuel/2 then
         r,g,b = 125,200,0      
      elseif fuel < maxfuel/1.5 then
         r,g,b = 50,200,0
      end
      dxDrawText ("Fuel:"..math.floor(fuel).."/"..maxfuel,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
    end

Edited by India
Link to comment
--Vehicle Infos

function vehicleStatus()
  local veh = getPedOccupiedVehicle (getLocalPlayer())
    if veh then
        local maxfuel = getElementData(veh,"maxfuel")
        local fuel = getElementData(getElementData(veh,"parent"),"fuel")
        local needengine = (getElementData(veh,"needengines") or 1)
        local needtires = (getElementData(veh,"needtires") or 4)
        local needparts = (getElementData(veh,"needparts") or 1)
        local engine = getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0
        local tires = getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0
        local parts = getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0
        local offset = dxGetFontHeight(1.02,"default-bold")
        local w = dxGetTextWidth(engine.."/"..needengine.." Engine",1.02,"default-bold")
        if engine == needengine then
            r,g,b = 0,255,0
        else
            r,g,b = 255,0,0
        end
        dxDrawText (engine.."/"..needengine.." Engine" ,screenWidth*0.5-w/2 , screenHeight*0,screenWidth*0.5-w/2 , screenHeight*0,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
        local w = dxGetTextWidth(tires.."/"..needtires.." Tires",1.02,"default-bold")
        if tires == needtires then
            r,g,b = 0,255,0
        else
            r,g,b = 255,0,0
        end
        dxDrawText (tires.."/"..needtires.." Tires",screenWidth*0.5-w/2 , screenHeight*0+offset,screenWidth*0.5-w/2 , screenHeight*0+offset,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
        local w = dxGetTextWidth(parts.."/"..needparts.." Tank Parts",1.02,"default-bold")
        if parts == needparts then
            r,g,b = 0,255,0
        else
            r,g,b = 255,0,0
        end
        dxDrawText (parts.."/"..needparts.." Tank Parts" ,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
      local w = dxGetTextWidth("Fuel:"..math.floor(fuel).."/90"..maxfuel,1.02,"default-bold")
      if fuel == maxfuel then
         r,g,b = 0,255,0
      elseif fuel < maxfuel/10 then
         r,g,b = 255,0,0   
      elseif fuel < maxfuel/4 then
         r,g,b = 255,50,0   
      elseif fuel < maxfuel/3 then
         r,g,b = 200,100,0
      elseif fuel < maxfuel/2 then
         r,g,b = 125,200,0      
      elseif fuel < maxfuel/1.5 then
         r,g,b = 50,200,0
      end
      dxDrawText ("Fuel:"..math.floor(fuel).."/"..maxfuel,screenWidth*0.5-w/2 , screenHeight*0+offset*2,screenWidth*0.5-w/2 , screenHeight*0+offset*2,tocolor ( r,g,b, 220 ), 1.02, "default-bold" )
    end
end
addEventHandler("onClientRender",root,vehicleStatus)

 

Link to comment
1 hour ago, DeadthStrock said:

 

Pickup items stopped, and i can't see part names

maybe here a problem?

VehiclesTable.lua

 

vehiclesTable = {
--{Name,ID,Eng,Tire,Parts,Rot,Glass,Slots,Fuel,FuelPerMinute}
    {"Bullet",541,1,4,1,0,4,100,100,0.1},
    {"Bobcat",422,1,4,1,0,4,20,80,0.25},
    {"Patriot",470,1,4,1,0,4,40,100,0.1},
    {"Camper",483,1,4,1,0,4,20,80,0.25},
    {"Clover",542,1,4,1,0,4,35,45,0.3},
    {"Quadbike",471,1,4,1,0,0,15,30,0.1},
    {"Sanchez",468,1,2,1,0,0,10,30,0.1},
    {"FCR900",521,1,2,1,0,0,10,40,0.1},
    {"Regina",479,1,4,1,0,4,40,60,0.035},
    {"Barracks",433,1,6,1,0,4,70,140,0.5},
    {"Coach",437,1,6,1,0,4,70,140,0.5},
    {"BMX",481,0,0,0,0,0,00,000,0},
    {"Dodo",593,1,3,1,1,4,20,60,0.25},
    {"Maverick",487,1,0,1,1,4,30,60,0.25},
    {"P Maverick",497,1,0,1,1,4,35,60,0.25},
    {"Cargobob",548,1,3,1,1,4,60,160,0.5},
    {"Tractor",531,1,4,1,0,0,25,80,0.25},
    {"Mesa",500,1,4,1,0,4,20,40,0.1},
    {"Sandking",495,1,4,1,0,4,60,80,0.7},
    {"Police Car",596,1,4,1,0,4,25,60,0.7},
    {"Infernus",411,1,4,1,0,4,25,60,0.8},
    {"Reefer",453,1,0,1,0,4,30,60,0.1},
}

--engine,tires,parts,rotor,glass,slots,fuel,fuelpm = getVehicleAddonInfos(getElementModel(veh))
function getVehicleAddonInfos(ID)
  for _,veh in pairs(vehiclesTable)do
    if ID == veh[2] then
      return veh[3],veh[4],veh[5],veh[6],veh[7],veh[8],veh[9],veh[10]
    end
  end
end


vehSpawns = {}
vehSpawns["Bullet"] = {
{-1829.5804443359,1288.6861572266,59.734375}}

vehSpawns["Sandking"] = {}


vehSpawns["Infernus"] = {
{408.83032226563,2495.2810058594,20.329418182373}}


vehSpawns["Bobcat"] = {
{-2479.6240234375,2223.6669921875,4.84375},
{-92.9951171875,2823.0908203125,76.721649169922},
{-2448.99609375,-1335.8662109375,310.97662353516},
{-173.2470703125,-2635.5341796875,26.608192443848},
{2108.447265625,-1600.916015625,13.552597045898},
{2452.7392578125,1607.9833984375,10.8203125},
{-1800.8984375,-1950.9736328125,93.561332702637},
{402.92279052734,2496.9677734375,16.484375}}

vehSpawns["Patriot"] = {
{-1473.5791015625,320.2294921875,7.1875},
{-1373.998046875,460.62109375,7.1875},
{419.150390625,2186.087890625,39.499450683594},
{2821.1796875,793.4658203125,10.8984375}}

vehSpawns["Camper"] = {
{303.8581,2040.5405,17.6406,184.6847},
{-235.5664,-207.0945,1.4297,27.6536},
{-1740.5837,-67.5864,3.5547,13.4941},
{2094.1072,-1581.1379,13.2511,27.7677}}

vehSpawns["Clover"] = {}

vehSpawns["Quadbike"] = {
{-738.1989,-125.3214,67.1632,203.8758},
{-1016.8008,-688.9416,32.0078,22.4471},
{-1545.8480,628.1342,7.1875,180.2506}}

vehSpawns["Sanchez"] = {
{-812.470703125,-2629.912109375,90.105056762695},
{-1729.8525390625,-1940.3154296875,99.840209960938},
{-2130.90234375,178.4375,35.257678985596},
{-2656.7333984375,1352.4873046875,7.0596733093262},
{-1598.302734375,2694.947265625,55.07092666626},
{-809.96484375,2430.037109375,156.97012329102},
{2920.38671875,2486.0087890625,10.8203125},
{505.732421875,-291.8681640625,20.00952911377},
{-428.8828125,-694.8310546875,19.14847946167},
{1190.41015625,-2109.0341796875,64.738548278809},
{1658.9716796875,-1069.0224609375,23.906229019165}}

vehSpawns["Regina"] = {
{280.61630249023,2020.4465332031,17.640625},
{138.6126,1784.9572,17.6406,98.7775}}

vehSpawns["Barracks"] = {
{86.486328125,1950.9013671875,17.846803665161},
{440.185546875,1464.173828125,6.3338670730591}}

vehSpawns["Coach"] = {
{-1971.4619140625,97.4658203125,27.6875},
{1735.8720703125,1429.0693359375,10.797702789307},
{2797.1318359375,-1868.8359375,9.8603811264038},
{1941.900390625,1975.1904296875,7.59375}}

vehSpawns["BMX"] = {
{194.685546875,-120.2333984375,1.5497757196426},
{173.0146484375,-95.0634765625,1.5516006946564},
{2369.9599609375,29.712890625,28.0416431427},
{710.87109375,-566.7548828125,16.3359375},
{1109.6025390625,-1667.6689453125,13.615442276001},
{2014.6689453125,-1113.4013671875,26.203125},
{2447.41015625,-1967.1845703125,13.546875},
{2633.7236328125,1835.291015625,11.0234375},
{1489.3974609375,2681.54296875,10.8203125},
{-2428.5654296875,2280.875,4.984375},
{-2501.0869140625,2224.880859375,4.9861993789673},
{-2142.8515625,-2457.84765625,30.625},
{-2456.078125,-141.115234375,26.112222671509},
{-1881.4453125,954.3837890625,35.171875}}

vehSpawns["Dodo"] = {
{279.32537841797,2020.9741210938,17.640625},
{-1227.2910,-127.5485,14.1484,152.2099},
{1282.6152,1323.6509,10.8203,91.4783}}

vehSpawns["Maverick"] = {
{-1495.888671875,-2691.40234375,57.325229644775},
{-2688.42578125,1471.634765625,7.1875},
{-1534.28125,2842.9482421875,97.463409423828},
{2221.8583984375,-1344.396484375,23.984273910522}}

vehSpawns["P Maverick"] = {
{-1354.9009,-580.84528,14.148438},
{-1467.4047,1488.0812,8.2500687},
{-1680.4514160156,707.12536621094,30.6015625}}

vehSpawns["Cargobob"] = {}

vehSpawns["FCR900"] = {}

vehSpawns["Tractor"] = {}

vehSpawns["Mesa"] = {}

vehSpawns["Police Car"] = {
{2314.9506835938,2460.3657226563,3.2734375},
{1601.1104736328,-1629.669921875,13.477452278137}}

vehSpawns["Reefer"] = {}
 

Edited by India
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...