[Release] Advanced Fuel System

yes i would like to know how to do this as well

How and where to change the price of gasoline?

@Divians

Its line 47 & 48 of the Config.lua

randomPrice = false --Random the price of each stations
price = 4.79 --If random price is on False, set the price here for 1 liter

Will set the price to 4.79 per liter

Advanced Fuel System update !

[Fix] : The event "advancedFuel:setEssence" has been fixed
[Fix] : Markers are in the right place !
[Fix] : When you are passager, you don't have the message which says that you are in an electric vehicle

-----------------------------------------------------

[Modification] : The random fuel is now between 30% and 100%

-----------------------------------------------------

[Add] : You can now buy petrol cans, you just have to go on a marker in a station
[Add] : You can now disable/able the fuel level bar and the fuel level text in the config.lua

For the installation process do we just go to resources/scripts then place it in the script folder?

You have to choose between the 3 folders and then drag and drop the good folder into your “resources” folder

The good folder??? And do I have to make a script folder

Yes, the good folder, you just have to read that :

And no, you don’t have to create another folder

Then do I go in resource list and add it

Meant resource lua. Lol

Not sure what the issue is, but how to select the amount of liters as the number 0 does not change in the gui at all for me… using VRP.

Left and right arrows

ah ok vrp that is the blinkers… let me try rebinding them

Yup works perfect. Thank you

Works great. One suggestion I would make is making the fuel bar a bit nicer? Like FRFuel does (using the default stamina bar).

2 Likes

Personally I happen to like the bar just as is…

how do i set min fuel in a car is 20 % or 30%

you could always turn off the fuel bar and add sexy speedometer to your resources they both work together so the gauge on it functions. the down side of it is unable to know your fuel in a aircraft and i am sure same goes for boats.

I add you line to set percent of fuel for vehicle but I don’t really know how to set it . I add it after "if(bool) then in server.lua . I don’t really know if it is good .

RegisterServerEvent("advancedFuel:setEssence_s")
AddEventHandler("advancedFuel:setEssence_s", function(percent, vplate, vmodel)
	local bool, ind = searchByModelAndPlate(vplate, vmodel)

	local percentToEs = (percent/100)*0.142
    
	if(bool) then
	    TriggerClientEvent("advancedFuel:setEssence", source, percent, plateOfTheVehicle, modelOfTheVehicle)
		serverEssenceArray[ind].es = percentToEs
	else
		table.insert(serverEssenceArray,{plate=vplate,model=vmodel,es=percentToEs})
	end
end)

By the way you can explain it how to add it this line in your developpers guide for newbie…you made it for random price and you tell to all this is at line 96 in server.lua, why don’t you do the same for this ?
Also , I looked at your’e commit to this script and don’t know if you know , but the commits “change the random 30% to 100%” , you rollback at your’e commits “change the visuals of notifications”…

you made this :

-		essence = (math.random(1,100)/100)*0.142
+		essence = (math.random(30,100)/100)*0.142

to this

-		essence = (math.random(30,100)/100)*0.142
+		essence = (math.random(1,100)/100)*0.142

Doesn’t even make sense …

Second edit : I solved my problem of % of fuel in vehicule my modify line 679 in client.lua by this :

essence = (math.random(30,100)/100)*0.142

Third edit : For those who cannot buy jerrycan at gaz station , replace line 118 in server.lua.

Replace this :

TriggerClientEvent("essence:hasBuying", _source)

by this

TriggerClientEvent("essence:buyCan", _source)

thanks, that’s great, I’ve used it for a week now, and it works great, but I’ve made a few changes to how much fuel is being used and added higher speeds for fuel.
And that you can buy a jerrycan for later filling is really good.