Fuel native in %

I’m writing a resource which shows your fuel and rpm etc.

I have written this function for getting the fuel but any ideas?

I haven’t written with fuel before, so that is why I’m asking.

local displayFuel
local fuel
local prevfuel = GetGameFuel()



function CalculateFuelToDisplay()
    fuel = GetVehicleFuelLevel()
end

Am I going the right way with fuel here or am I completely wrong

GetVehicleFuelLevel(Vehicle) Reports the amount of fuel that the vehicle has In a float variable, So as long as you add The car you’re getting the fuel value of you’re on the right track.

Just in case you don’t already have it here’s a link to all of the Native references

Okay, thank you, this is what I have so far.

local displayFuel
local displayRpm
 
local fuelAndRpmString = nil
local fuel
local rpm
local player = GetPlayerPed(-1)
 
local rgb = {r = 255, g = 153, b = 102}
local prevfuel = GetGameFuel()
local prevrpm = GetGameRpm()
 
function CalculateFuelToDisplay()
    fuel = GetVehicleFuelLevel(GetVehiclePedIsIn)
   
    vehicle = GetVehiclePedIsIn(player, false)
    isPlayerInside = isPedInAnyVehicle(player true)
    player = GetPlayerPed(-1)
    lastVehicle = GetPlayersLastVehicle()
    px, py, pz = table.unpack(GetEntityCoords(player, true)
    coordA = GetEntityCoords(player, true)
   
    if isPedInAnyVehicle = true then
        GetVehicleFuelLevel(GetVehiclePedIsIn)
end
 
function PrintText(text)
    SetTextEntry("STRING")
end

@BabbaTundaee

function CalculateFuelToDisplay()
    player = GetPlayerPed(-1)
    vehicle = GetVehiclePedIsIn(player, false)
    fuel = GetVehicleFuelLevel(vehicle)
    isPlayerInside = isPedInAnyVehicle(player, true)
    lastVehicle = GetPlayersLastVehicle(player)
    px, py, pz = table.unpack(GetEntityCoords(player, true)
    coordA = GetEntityCoords(player, true)
end

It is used for determining the fuel amount in the vehicle.

Oh, I didn’t realize it was a native (whoops)
I edited my post

Yeah I didn’t at first, I had to search the natives for it, https://runtime.fivem.net/doc/reference.html#_0x5f739bb8