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

I see, that’s a bit over my head currently so I’ll try to find another solution.

Thanks very much for taking the time to help out!

Is this script ever gonna get updated for helicopters and other aircraft?

It uses the actual prop located around the map. You will need to manually add some more physical pumps in order to achieve what ur trying to do.

so you have to add the actual gasstation prop to get it to wotk?

do you have the map for it , if you do do you mind sending it to me. it would be greatly appreciated.

As far as planes and helicopters, just add a fuel truck and add it to the model list. Then just drive up to the aircraft and fuel it.

Do you know one i can possibly use. If you can link it for me

Edit: nevermind i found one

Thanks guys.

How can i change do it takes longer for vehicle to consume fuel?

change the rpmfuelusage

if rpm > 0.9 then
rpmfuelusage = fuel - rpm / 0.8
Citizen.Wait(1000)

So if i want to lower usage i increase the 0.8?

yes. I actually increased mine a lot. I tested with a super car running laps around LSIA. I use about 1.5% per lap at full throttle when it used to be about 6-10%. I figure the 1.5% is about right for that type of car.

These are my settings:

if rpm > 0.9 then
				rpmfuelusage = fuel - rpm / 5.0
				Citizen.Wait(1000)
			elseif rpm > 0.8 then
				rpmfuelusage = fuel - rpm / 6.0
				Citizen.Wait(1500)
			elseif rpm > 0.7 then
				rpmfuelusage = fuel - rpm / 7.0
				Citizen.Wait(2000)
			elseif rpm > 0.6 then
				rpmfuelusage = fuel - rpm / 9.0
				Citizen.Wait(3000)
			elseif rpm > 0.5 then
				rpmfuelusage = fuel - rpm / 10.0
				Citizen.Wait(4000)
			elseif rpm > 0.4 then
				rpmfuelusage = fuel - rpm / 11.0
				Citizen.Wait(5000)
			elseif rpm > 0.3 then
				rpmfuelusage = fuel - rpm / 12.0
				Citizen.Wait(6000)
			elseif rpm > 0.2 then
				rpmfuelusage = fuel - rpm / 13.0
				Citizen.Wait(8000)
			else
				rpmfuelusage = fuel - rpm / 15.0
				Citizen.Wait(15000)
			end
1 Like

When I added this to my server (that is Non-ESX server) it didn’t work. I mean parts of it did like if I ran out of gas I will break down on the road and the fuel station had “Press G to fuel your vehicle” but when I hit G it never fuels it or goes in an animation or anything. I still drive around with the gas I originally spawned in with. I have the script off my server till I can find out what is wrong with it.

I use the ESX version for my production server. However, I’ve tested the non ESX version on my non ESX Dev server and it worked perfect right out of the box.

Could you add something like esx_advancedfuel has to set the fuel when spawning in different jobs? So it’s like 100% fuel etc. Can’t seem to find this in your script and it would be really nice to have this to replace all the esx_advancedfuel codes in different scripts we are using!

RegisterNetEvent("advancedFuel:setEssence")
AddEventHandler("advancedFuel:setEssence", function(percent, plate, model)
	local toEssence = (percent/100)*0.142

	if(GetVehicleNumberPlateText(GetVehiclePedIsUsing(GetPlayerPed(-1))) == plate and model == GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(GetPlayerPed(-1))))) then
		essence = toEssence
		local essenceToPercent = (essence/0.142)*65
		SetVehicleFuelLevel(GetVehiclePedIsIn(GetPlayerPed(-1)),round(essenceToPercent))
	end

	TriggerServerEvent("advancedFuel:setEssence_s",percent,plate,model)
end)
1 Like

The script doesn’t seem to like custom addons car…
I’ve added all boat the the blacklist model so they won’t use gas and it work… but if I add a addons boat that I have even tho it’s in the blacklist it will still use gas…

Try getting the display name by adding this thread to your client file. In your console (F8) you’ll get what you need to add in the blacklistedVehicles table

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1000)

        if IsPedInAnyVehicle(GetPlayerPed(-1)) then
            print(GetDisplayNameFromVehicleModel(GetEntityModel(GetVehiclePedIsUsing(GetPlayerPed(-1)))))
        end
    end
end)

thanks,

the display name was not the same ^^

@InZidiuZ I have a problem. It works fine, but I added a visual mod by client side, and the text is not showing in those purple box. Any hint?

Easiest fix would be to remove the visual mod, not sure what could be causing that. :stuck_out_tongue_winking_eye:

can’t change it to normal text and not 3d?