[Release] Advanced Fuel System

How did you change how much fuel is being used? i’ve just been looking at that but cant figure out how :slight_smile:

take a look from around line 330 in client.lua

Thanks can you clarify a bit more :smiley: Guess its somewhere in here but i realy dont understand the way to do it :

Citizen.CreateThread(function()

	while true do
		Citizen.Wait(1000)

		if(IsPedInAnyVehicle(GetPlayerPed(-1), -1) and GetPedVehicleSeat(GetPlayerPed(-1)) == -1 and not isBlackListedModel()) then
			local kmh = GetEntitySpeed(GetVehiclePedIsIn(GetPlayerPed(-1), false)) * 3.6
			local vitesse = math.ceil(kmh)

			if(vitesse > 0 and vitesse <20) then
				stade = 0.00001
			elseif(vitesse >= 20 and vitesse <50) then
				stade = 0.00002
			elseif(vitesse >= 50 and vitesse < 70) then
				stade = 0.00003
			elseif(vitesse >= 70 and vitesse <90) then
				stade = 0.00004
			elseif(vitesse >=90 and vitesse <130) then
				stade = 0.00005
			elseif(vitesse >= 130) then
				stade = 0.00006
			elseif(vitesse == 0 and IsVehicleEngineOn(veh)) then
				stade = 0.0000001
			end

			if(essence - stade > 0) then
				essence = essence - stade
				local essenceToPercent = (essence/0.142)*65
				SetVehicleFuelLevel(GetVehiclePedIsIn(GetPlayerPed(-1)),round(essenceToPercent))
			else
				essence = 0
				SetVehicleFuelLevel(GetVehiclePedIsIn(GetPlayerPed(-1)),0)
				SetVehicleUndriveable(GetVehiclePedIsUsing(GetPlayerPed(-1)), true)
			end			
		end
	end

end)

Higher stade numbers are more fuel consumption, lower numbers less consumption.
vitesse is km/h where consumption is set up according to your speed, top is 0 - 20 km/h next is 20 - 50 km/h etc, etc.

Sorry for my late respons! BUT i got it to work thanks to you sir! :wink:

Thank you very much! its a pleasure to drive around now without worrying the fuel is running out every minute or two xD

How hard would it be to switch to gallons instead of liters? I k ow I can change the text but the tanks seem too big.

how can i zoom the text of the gasoline percentage?

how do you use petrol cans

Is there anyway to change the script so it’s gallons not liters?

@n0thus I cant figure out how to use the petrol cans on VRP, Let me know :slight_smile:

It worked for me like this:

  1. Bought the can. (don’t have car refilled to 100%. Have it for a like a half or whatever, so that you can see the changes. )
  2. Get out of the car.
  3. Take the can.
  4. Go next to the car (Maybe go a bit a way from it and then back(Maybe at the end of the car as well))
  5. Press E (if I remember it correctly) and it should FULLY refuel your car and take 1 “ammo/capacity” out of it.

(If you have 1 of 100 “ammo/capacity” it will fully refuel the car. Yes, you can stack it up to 100 and FULLY refuel it 100 times.)
Let me know if this worked.

It doesn’t drop any fuel can when you buy it, do I have to put something into vrp

Is there a way to use the script by itself without essential mode, vrp or esx?

Works fine for me. If needed. You can probably tweak it a bit.

THats super wierd, it doesnt drop any fuel tank for me :confused:

Technically it doesn’t drop it, it just adds/gives it to your Weapons selection/hands.
Are you having any errors? Are you using any other fuel systems?

No,
THere are no errors either.

I just did a fresh copy, and deleted cache

it is possible to apply this script just to boats, planes and helicopters ?

How can i make it so the gas is free? I have problems with frfuel and am trying this but i want it to be free. Ive tried changing all cost values in the config, it will say it costs 0 in game but when you try to get the fuel it will say i dont have enough.