[PAID] [QB/ESX] TebIT: Fuel


image

Fuel



This resource is intended to give greater control over vehicle fuel economy, while adding another layer of variation and tuning capabilities for our upcoming vehicle tuning resource.

  • Different fuel types, each defined with different “stats”, e.g: “knock rating”, “efficiency rating”, “power rating”.
  • Each vehicle class has a configurable “economy” value, allowing you to effect the drain rate of each vehicle class individually (think: motorcycles drain fuel slower then sports cars).
  • Each vehicle class has a configurable “tank size” value. This modifies the amount of time it takes to completely drain a vehicles fuel tank (works in conjunction with class economy above). This value also simulates an increased tank size by effecting how long it will take to refuel, and all subsequent fuel “labels” will represent a modified value (e.g: a vehicle with 1.0 tank modifier will read 100 units max, a 3.5 rating would read 350 units max).
  • Straight-forward usage-by-rpm modifier.
  • Realistic fuel nozzle and hose props that attach nicely to all types of vehicles.
  • Addon fuel pumps, allowing you to create special locations for electric vehicle charging, or race fuel restocking, allowing only a given type of fuel.
  • Proper electric vehicle handling (electric vehicles can only be charged by electric stations, proper “recharging/refueling” labels, etc).
  • Purchase and use jerry cans with specific fuel types for emergency refills.
  • Purchase and use battery boosters for an emergency electric-vehicle fuel boost.
  • All jerry can/battery booster purchasing facilitated through pump interaction UI.
  • Each fuel station has configurable “pump speeds” for added variation of refueling time.
  • Each fuel station has configurable fuel types, with stock levels for each station that restock automatically given a configurable amount over-time.
  • Station stock levels are stored between restarts.
  • Exports provided to increase/reduce stock level at stations as required (if you wish to hook some type of fuel delivery trucking job up to this).
  • Toggleable config option to explode pumps if player attempts to drive away while refueling with nozzle still attached to car.

Config

All of the config vars found below are stored within the config.lua file.

Expand
config = {
    -- Interact distance for players. Vehicle interact distance is 2x this.
    interactDist = 2.5,

    -- Hose distance, aka maximum distance for the nozzle to reach.
    hoseDist = 5.0,

    -- Minimum distance to stations to consider any actions.
    renderDist = 25.0,

    -- Size (litres) of a jerry can (or battery, for EVs).
    jerryCanSize = 10.0,

    -- How long it takes to refuel using a jerrycan (or battery).
    jerryCanTime = 5000,

    -- On refueling (nozzle attached to vehicle, actively pumping fuel), when player drives away with nozzle attached.
    allowRefuelingExplosions = true, 

    -- Keep nozzle attached after explosion? May help police figure out who caused a petrol bowser explosion in the area.
    keepNozzleAttached = true, 

    -- Controls how blips are displayed.
    -- 0 = off
    -- 1 = all on
    -- 2 = display only closest
    blipDisplay = 2,

    -- Blip data.
    blip = {
        label = "Fuel Station",
        sprite = 361,
        color = 1,
        alpha = 150,
        scale = 0.5,
        display = 2,
        highDetail = true,
        shortRange = true
    },

    -- How much fuel is drained per fuelDrainRate.
    fuelDrainRate = 0.01,

    -- How fast to drain fuel.
    -- NOTE: With 1.0 fuelDrainRate, and 1000 fuelDrainTime, the drain rate for any vehicle (other modifiers not considered)
    --       would equate to exactly 1% of your fuel being drained every 1000ms (1 second).
    fuelDrainTime = 10000,

    -- Base refuel rate.
    -- Can be supplemented further with individual station pump speeds.
    refuelAddRate = 5.0, 

    -- Fuel economy based on vehicle class
    -- Lower = less fuel used
    classEconomy = {
        [0] = 0.5,
       ...
    },

    -- Fuel tank size based on vehicle class
    -- Lower value = less time to burn max fuel reserve,
    --               also less time to refuel vehicle at station.
    classTank = {
        [0] = 0.6,
       ...
    },

    -- How much fuel is used at given RPM
    rpmUsage = {
        [1.0] = 1.00,
       ...
    },   

    electricVehicles = {
        `Imorgon`,
       ...
    },
}

Station Definition

For information on fuel station definitions and config options, read the documentation
All existing stations are already pre-configured within the data/stations.lua file.
You can define new addon pumps in here.


Fuel Types

For information regarding fuel type definition and stat configuration, read the documentation
A working example can found in the data/fueltypes.lua file.


Labels

All labels and translations can be found within the labels.lua file.

Expand
labels = {
    no_vehicles_nearby = "No vehicle nearby",
    empty_driverseat_required = "Vehicle must not have a driver",
    ...
}

Usage

Check out the wiki for an update-to-date list of dependencies, conflicting resources, examples, and proper export documentation. You can otherwise contact me via DM for further instruction.

Code is accessible No
Subscription-based No
Lines (approximately) 2000 +
Requirements ti_utils
Support Yes
8 Likes

this is cool, if the gas stations was player owned and operated this would be the best fuel script of fivem!

3 Likes

Agree 100%

3 Likes

There are a few exports to control the stock levels of the stations, leaving it pretty open ended for player owner and delivery addons in the future :slight_smile:

Can only recommend, been a tester by tebit, he didnt leave much work to us lol, keep it up tebit!

2 Likes

this is dope, super dope.
Thanks for making exports!
Is this essentially replacing LegacyFuel?

1 Like

This is backward compatible with LegacyFuel :slight_smile:

1 Like

Looks awesome, great work!

1 Like

Thankyou!

Great Resource! As a tester cant suggest a better script for fuel.

Works well with other ideas!

1 Like

are you looking into target integration

2 Likes

I agree, Target would be nice.

1 Like

Thanks for the feedback, will certainly keep this in mind!

All of our menu calls are passed through our utility file, which allows us to add support in the future for things like a third eye menu solution in place of our context solution with relative ease (no requirement for updating multiple resources)- we’ve currently got a few members in the discord helping out with extra inventory compatibility. If you wanted to take part in getting a third eye solution in place join us on our discord and make your requests known! :slight_smile:

Hopefully we’ll have an update for you both some time in the near future!

1 Like

Can the fuel price vary over time?

Very useful for those who want to push the simulation on vehicles but also a more than good alternative to fuel that we see everywhere, I recommend!

1 Like

Could you show me the ms?

0.00-0.01 - All the time.
0.03-0.04 - When standing near pump and UI text is being rendered.

Hope that helps :slight_smile:

1 Like

Sorry, I must have missed this message originally-
The fuel price does not vary automatically.

This connected/supported with Projeto Charmoso Lixeiro Charmoso Gas Stations will be the endlevel <3

Oh yes that would really be the end level