Jump to content

[HELP] MTA DayZ new vehicle fuel


Recommended Posts

I added new car for my mta dayz server every thing is correct but i dont know why on the top of screen i dont see "Fuel:0/60" (randomly numbers). When im entering car like patriot i'd can se it but in my Moonbeam i can't pls help me ;]

Sorry for eng.

my code :

  for i, veh in ipairs(moonSpawns) do 
    local x, y, z = veh[1], veh[2], veh[3] 
    veh = createVehicle(418, x, y, z) 
    vehCol = createColSphere(x, y, z, 2.5) 
    attachElements(vehCol, veh, 0, 0, 0) 
    setElementData(vehCol, "parent", veh) 
    setElementData(veh, "parent", vehCol) 
    setElementData(vehCol, "vehicle", true) 
    setElementData(vehCol, "MAX_Slots", 40) 
    local tires, engine, parts = getVehicleAddonInfos(getElementModel(veh)) 
    setElementData(vehCol, "Tire_inVehicle", math.random(0, tires)) 
    setElementData(vehCol, "Engine_inVehicle", math.random(0, engine)) 
    setElementData(vehCol, "Parts_inVehicle", math.random(0, parts)) 
    setElementData(vehCol, "spawn", { 
      418, 
      x, 
      y, 
      z 
    }) 
    setElementData(vehCol, "fuel", 10) 
    for i, items in ipairs(lootItems.helicrashsides) do 
      local randomNumber = math.random(1, 10) 
      if randomNumber == 5 then 
        setElementData(vehCol, items[1], 1) 

Link to comment

well if you already made a table and executed it correctly, you have a little mistake, if you want the 0/60 for "ALL" vehicles ofc you need to put them in a table and execute them correctly

you executed the table good and everything, but at line 3

 veh = createVehicle(418, x, y, z) -- you created a specific vehicle therefor it will only appear for this ID 

should be

 veh = createVehicle(vehID, x, y, z) -- in the table define the vehicle IDs first then the x,y,z 

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...