[Release] SimpleCarHUD - Standalone Car HUD for Speed, Fuel, Seatbelt, Cruise, Time and Location [v1.30]

– Draw fuel gauge; always displays 100 but can be modified by setting currentFuel with an API call
fuelColor = (currentFuel >= fuelWarnLimit) and fuelColorOver or fuelColorUnder
drawTxt(("%.3d"):format(math.ceil(currentFuel)), 2, fuelColor, 0.8, screenPosX + 0.050, screenPosY + 0.000)
drawTxt(“FUEL”, 2, fuelColorText, 0.4, screenPosX + 0.080, screenPosY + 0.020)

So what exactly is line 104 supposed to look like? Might have the currentFuel = GetVehicleFuelLevel(vehicle) in the wrong spot…

line 104 currentFuel = GetVehicleFuelLevel(vehicle)
line 105 fuelColor = (currentFuel >= fuelWarnLimit) and fuelColorOver or fuelColorUnder

ahh thanks! works perfectly.

glad its working played with it last night tried like 5 different ways

Nice work! I’ve been playing with it for a few days and couldn’t get it.

1 Like

Or you could have just turned off the fuel text in carhud and moved the text from your fuel script into place. Then it’s more accurate to your fuel script

By the way, great HUD. I tweaked it a little for what I needed though.



You better take off fuel from the hud if it’s not consumpted whatsoever, although, that’s a nice and simple.

I’m not using this HUD’s fuel. I use legacyfuel and just moved it’s text into place.

I was talking about the script author, he better remove the fuel thingy or tell others to intergrate with other fuel systems.

Everything you need is in the source code, read through it and it should be easy to add :+1:

-- Draw fuel gauge; always displays 100 but can be modified by setting currentFuel with an API call
currentFuel = GetVehicleFuelLevel(vehicle)
fuelColor = (currentFuel >= fuelWarnLimit) and fuelColorOver or fuelColorUnder
drawTxt(("%.3d"):format(math.ceil(currentFuel)), 2, fuelColor, 0.8, screenPosX + 0.050, screenPosY + 0.000)
drawTxt("FUEL", 2, fuelColorText, 0.4, screenPosX + 0.080, screenPosY + 0.020)

I’m releasing resources as I make them and updating as necessary, I’ve made it easy for developers to integrate but if you want a copy-paste resource then I plan to update it eventually just no ETA

How can I change it to km/h?

Line 37

 -- Display information only when in vehicle
        if (IsPedInAnyVehicle(player, false)) then
            -- Get vehicle speed and draw speedometer
            local speed = GetEntitySpeed(GetVehiclePedIsIn(player, false))*3.6
            speedColor = (speed >= speedLimit) and speedColorOver or speedColorUnder
            drawTxt(("%.3d"):format(math.ceil(speed)), 2, speedColor, 0.9, screenPosX, screenPosY)
            drawTxt("KMH", 2, speedColorText, 0.4, screenPosX + 0.035, screenPosY + 0.024)

I only have Kmh and the street label working the fuel and the belt arent working can someone help?
also how can i re-size the font for “KMH numbers and fuel” they are too big

There is a post above here that helped me with the fuel not working. Very easy fix.
I also had problems with my seatbelt, and it turned out it was conflicting with esx_personmeny’s seatbelt script. Hope that helps!

Thanks for the KMH snippet!

This is my Fuel snippet i dont know thats wrong…

-- Draw fuel gauge; always displays 100 but can be modified by setting currentFuel with an API call
            currentFuel = GetVehicleFuelLevel(vehicle)
            fuelColor = (currentFuel >= fuelWarnLimit) and fuelColorOver or fuelColorUnder
            drawTxt(("%.3d"):format(math.ceil(currentFuel)), 2, fuelColor, 0.8, screenPosX + 0.050, screenPosY + 0.000)
            drawTxt("FUEL", 2, fuelColorText, 0.4, screenPosX + 0.080, screenPosY + 0.020)

also im using SeatbeltIndicator whats the “key” for seatbelt maybe thats conflicting my “key” is “G” for activating and deactivating the seatbelt

On line 37, change the local currentFuel = 100.0 to local currentFuel = 0.0 (Assuming you’re using LegacyFuel)
I had to completely remove my other seatbelt scripts to get it working. I also had an indicator one which made the SimpleCarHUD one not work. But the SimpleCarHUD indicator next to the map works fine so it isn’t a big loss to remove the others.

thx but still not working dont know why can u send me your client.lua ? Sry

Here you go!
https://pastebin.com/vm3fHQ7J

3 Likes

Updated the release to work with the legacy fuel API and changes to the HUD layout and behavior.