[Release] [ESX & Non-ESX] LegacyFuel system

People with ultrawide monitors seem to have an issue where the “Fuel” text overlaps the MPH, is there a fix for this?

How would one make it so that instead of taking money off the player it takes money from the bank?

For Anyone That Needs Help Heres How To Make This Work With Heli’s and Planes Better

In main.lua, under local rpmfuelusage = 0, line 527

Replace

if rpm > 0.9 then
					rpmfuelusage = fuel - rpm / 0.8
					Citizen.Wait(1000)
				elseif rpm > 0.8 then
					rpmfuelusage = fuel - rpm / 1.1
					Citizen.Wait(1500)
				elseif rpm > 0.7 then
					rpmfuelusage = fuel - rpm / 2.2
					Citizen.Wait(2000)
				elseif rpm > 0.6 then
					rpmfuelusage = fuel - rpm / 4.1
					Citizen.Wait(3000)
				elseif rpm > 0.5 then
					rpmfuelusage = fuel - rpm / 5.7
					Citizen.Wait(4000)
				elseif rpm > 0.4 then
					rpmfuelusage = fuel - rpm / 6.4
					Citizen.Wait(5000)
				elseif rpm > 0.3 then
					rpmfuelusage = fuel - rpm / 6.9
					Citizen.Wait(6000)
				elseif rpm > 0.2 then
					rpmfuelusage = fuel - rpm / 7.3
					Citizen.Wait(8000)
				else
					rpmfuelusage = fuel - rpm / 7.4
					Citizen.Wait(15000)
				end

with this

local vehicleClass = GetVehicleClass(vehicle)
			
			if vehicleClass == 15 then
			
				rpmfuelusage = fuel - rpm / 0.45
				Citizen.Wait(1000)
			
			elseif vehicleClass == 16 then		
				
				if rpm > 0.3 then
					rpmfuelusage = fuel - rpm / 0.3
					Citizen.Wait(1000)
				elseif rpm > 0.28 then
					rpmfuelusage = fuel - rpm / 0.35
					Citizen.Wait(1500)
				elseif rpm > 0.26 then
					rpmfuelusage = fuel - rpm / 0.4
					Citizen.Wait(2000)
				elseif rpm > 0.24 then
					rpmfuelusage = fuel - rpm / 0.45
					Citizen.Wait(3000)
				elseif rpm > 0.22 then
					rpmfuelusage = fuel - rpm / 0.5
					Citizen.Wait(4000)
				elseif rpm > 0.20 then
					rpmfuelusage = fuel - rpm / 0.55
					Citizen.Wait(5000)
				else
					rpmfuelusage = fuel - rpm / 0.6
					Citizen.Wait(6000)
				end
				
			else
				if rpm > 0.9 then
					rpmfuelusage = fuel - rpm / 0.8
					Citizen.Wait(1000)
				elseif rpm > 0.8 then
					rpmfuelusage = fuel - rpm / 1.1
					Citizen.Wait(1500)
				elseif rpm > 0.7 then
					rpmfuelusage = fuel - rpm / 2.2
					Citizen.Wait(2000)
				elseif rpm > 0.6 then
					rpmfuelusage = fuel - rpm / 4.1
					Citizen.Wait(3000)
				elseif rpm > 0.5 then
					rpmfuelusage = fuel - rpm / 5.7
					Citizen.Wait(4000)
				elseif rpm > 0.4 then
					rpmfuelusage = fuel - rpm / 6.4
					Citizen.Wait(5000)
				elseif rpm > 0.3 then
					rpmfuelusage = fuel - rpm / 6.9
					Citizen.Wait(6000)
				elseif rpm > 0.2 then
					rpmfuelusage = fuel - rpm / 7.3
					Citizen.Wait(8000)
				else
					rpmfuelusage = fuel - rpm / 7.4
					Citizen.Wait(15000)
				end
			end

Feel Free to mess with the math to get it feeling better, this was the best i came up with in a few mins.

Heyo, I don’t see any Gas Cans anywhere…

When i fill my vehicle to “100”, sometimes the fuel suddenly drops to “60”, does anyone know why?

Whenever I try to fuel a vehicle i can’t, says I don’t have enough money even tho I have enough in hand. Any solutions for this?

Anyone has the fix for jerrycan?

1 Like

Why when i start my server on the map the blip shows like “ge”?

What line is to change the location of draw text

Where can i find to change the position of the fuel % and the speed?

how add jerry can?

1 Like

Any reason my fuel price is zero?

1 Like

Hi all can i rack your brains out there please mine is getting on now at 55 lol but love FiveM, im trying to move Fuel level to under my sexyspeedo as show under

I would be so Greatfull for any help in this please. Nick

esx_legacyfuel/Client/main.lua

Find this and change the x and y coordinates listed below:

	local playerPed = GetPlayerPed(-1)

	if Config.ShouldDisplayHud and IsPedInAnyVehicle(playerPed, false) and GetSeatPedIsIn(playerPed) == -1 then
		local vehicle = GetPlayersLastVehicle()
		local fuel    = math.ceil(round(GetVehicleFuelLevel(vehicle), 1))
		local speed   = GetEntitySpeed(vehicle)
		local kmh     = round(speed * 3.6, 0)
		local mph     = round(speed * 2.236936, 0)

		if fuel == 0 then
			fuel = "0"
		end
		if kmh == 0 then
			kmh = "0"
		end
		if mph == 0 then
			mph = "0"
		end

		x = 0.01135
		y = 0.008

		DrawAdvancedText(0.2195 - x, 0.83 - y, 0.100, 0.0028, 0.6, fuel, 255, 255, 255, 255, 6, 1) -- Change me to change fuel number

	        DrawAdvancedText(0.200 - x, 0.83 - y, 0.092, 0.0028, 0.6, "Fuel", 255, 255, 255, 255, 6, 1) --Change me to change where the word Fuel is.

		--DrawAdvancedText(1.130 - x, 0.07 - y, 0.005, 0.0028, 0.6, mph, 255, 255, 255, 255, 6, 1) 
		--DrawAdvancedText(1.174 - x, 0.07 - y, 0.005, 0.0028, 0.6, kmh, 255, 255, 255, 255, 6, 1) 

		
	end
end

hi fella did you mean edit this
x = 0.01135
y = 0.008

0.2195 - x 0.83 - y - Only change the numbers, listed above and the same with the one that says “fuel”

ok got it thanks i will try it now

If you move the number too far the number may be off screen so just play around with it little by little until you know which number makes it go which way.

OK will do :slight_smile:

quick ? X and Y witch way do they move i know z up and down