[Release] FRFuel [v1.7.0]

FRFuel v1.7.0

This is a simple fuel system for all on-ground vehicles designed to be as unobtrusive as possible.

Download link

Source code link

Features

  • Fuel level synchronized between players vehicles
  • Vehicle’s dashboard shows actual fuel level
  • Randomized fuel level for NPC’s vehicles
  • RPM based fuel consumption
  • Vehicle max torque and acceleration has impact on overall fuel consumtion rate
  • Original fuel tank capacity for every vehicle, taken from handling
  • All gas stations that is in game are available
  • Events
  • External API
  • Configurable both fuel consumption rate and refueling rate, so you can fine-tune it exactly for your needs

Installation

  1. Download zip archive from latest release and unzip it to your resources folder.
  2. Add start frfuel line to your server.cfg.

Known issues

  1. If you encounter a crash stating something like “Increase pool size” then server with FRFuel is using some broken resource that is using entity decorators excessively. We can’t help spotting it. If you’re using manual transmission mode by ikt, consider updating it to the latest version to address this issue.

Planned features

  • Extend fuel system to planes and boats

Events

frfuel:refuelAllowed <- (toggle: bool)

Client event.
FRFuel listens for it.
Allows you to toggle on/off if player can refuel it’s vehicle.

frfuel:fuelAdded -> (amount: float)

Both client and server event.
FRFuel triggers it.
Allows you to get know how much fuel player just added to his vehicle.
Units for amount value could be considered as litres. Typical petrol tank volume is 65 litres in GTA.


API

Since v1.2.0 there’s an external API available for resources to work with this one:

All of the API methods only working for player’s current vehicle ONLY if player is on the driver seat

getCurrentFuelLevel(): float

Returns player’s current vehicle’s fuel level. Returns -1 if player is not in vehicle or is not on the driver seat.

addFuel(amount: float): void

Adds amount of fuel to the player’s current vehicle. Does nothing if player is not in any.

setFuel(amount: float): void

Sets amount of fuel level of the player’s current vehicle. Does nothing if player is not in any.

Lua example
--- getting level
local fuelLevel = exports.frfuel:getCurrentFuelLevel()

--- adding more fuel
exports.frfuel:addFuel(42.5)

--- setting fuel level
exports.frfuel:setFuel(65)

Changelog

v1.7.0 - Some new features and fixes.

v1.7.0

  • Change/fix the fuel bar position and size for when the expanded radar is active.
    image
  • Add fuelbar color options to the config.ini, example of custom color: image
    Example of custom warning fuel level color:
  • CFX API packages have been updated to the new NuGet packages.

v1.6.0

(Update by Vespura, if you have any issues ask him first)

  • (New) Add ShowHudWhenEngineOff option (default: ShowHudWhenEngineOff=true), if you set this to false then the fuel level bar will not be shown if you turn your engine off and you’re not near any gas stations.
  • (Fix) Disable the vehicle horn when you are able to press the ‘toggle engine’ button near a gas station. The INPUT_VEH_ROCKET_BOOST control is also disabled, so you won’t launch your oppressor into the pumps anymore when refueling. These controls will not be disabled if you changed the engine toggle key to something other than the INPUT_VEH_HORN control.
  • (Internal change) Temporarily use a local version of the CFX API set instead of the (outdated) NuGet version. This should be reverted once the NuGet package is updated at some point.
  • (Fix/Change) Changed the way nearby vehicles are detected when manually refueling using a jerrycan. This should hopefully fix most issues related to some emergency (and other) vehicles not being detected when holding a jerrycan to refuel.

v1.5.0

v1.3.0

(Update by @Vespura)

  • Added a new json file called GasStations.json so you can create your own gas stations.
    Simply copy one of the gas stations and add it below the existing ones (make sure the format of the json stays intact! Any invalid json will BREAK the json file and will NOT allow the resource to function properly.

v1.2.0

  • Add external API for other resources to control this one

v1.1.1

(Update by @Vespura)

  • Fix engine randomly turning back on. (temporary fix, shouldn’t be in here for long)
  • Hud overlay (fuel bar) will now be disabled if you disable the hud preference in your game settings.
  • Added resource manifest version.
  • Added debug error message in case the config file fails to load.
  • Add customization option for engine on/off toggle control.
    Edit the config file to change this button.
  • Fix readme.md builds image redirect url.
  • Bumped version number.

v1.1.0

  • Fix mod not starting on join

v1.0.8

v1.0.7

  • Fix engine control (thanks to @a_sith )
  • Make hud displaying optional

v1.0.6

  • Fix fuel bar on all aspect ratios (kudos to @Disquse)

v1.0.5

  • Add taking max fuel level from handling

v1.0.4

  • Disable temp manual engine cut-off

v1.0.3

  • Add temp engine cut-off when vehicle run out of fuel

v1.0.2

  • Fix missing default behaviour of starting engine when vehicle is driveable

v1.0.1

  • Fixed not working gas stations when blips creation turned off

v1.0.0

  • Added per-pump refueling, so one should get close to particular pump instead of center of gas station
  • Removed yellow marker circle
  • Added config file, so creation of blips and/or pick-ups is now could be turned off

v0.0.9

  • Fixed attempt to create blips and pickups too early

v0.0.8

  • Fixed fuel level maximization on vehicle fix

v0.0.7

  • Add events.

v0.0.6

  • Reworked help text to native instructional buttons.
  • Removed conflicting gas stations.

v0.0.5

  • Fuel bar will now respect your screen safe zone.

v0.0.4

  • Add manual refueling using Jerry Can.
  • Add spawning Jerry Cans at every gas station.
  • New algorithm of refueling: you need to completely stop inside gas station, then Horn to turn engine off, refuel, Horn again to turn engine on.

F.A.Q.

1. How do I make fuel consumption slower/faster?

There’s a special config option FuelConsumptionRate. Set it to something less than 1, e.g. 0.25 - 4 times slower consumption, or something more than 1 to increase rate as well, e.g. 2 - 2 times faster consumption rate.

2. How do I increase/decrease fuel tank capacity of this particular vehicle?

We don’t provide such option yet. But you can go hard way of custom handling file for this particular vehicle, it’s hard, but possible, search forums.

3. How do I disable fuel consumption for this particular vehicle?

So you have some electrical vehicle, great. In general, we don’t provide such option in the easy way as well. See F.A.Q. entry 2 for the hard way. Or check the spoiler below.

How to make electric vehicles have no fuel.

4. I want an integration with my favorite RoleplaySystem™, how?

Thing is, we won’t ever accept any integration with any such system into the mod itself, we want to keep it as pure as possible, because there’re plenty of users who just don’t need such integrations. Instead, we want to encourage people to make separate integrations with such systems. We will definitely add links to these integrations to this topic. Also we’re considering moving FRFuel to separate github org and putting these integrations under such org so people could easily find them.

93 Likes

Amazing :open_mouth: thanks for the release!

1 Like

If you hit the vehicle, the fuel increases.

3 Likes

Cannot reproduce. Could you please specify circumstances?

Works for me in essentialmode base, thank you

Hmm. the engine shuts off randomly while driving, even with full tank.

1 Like

I also have the same issue.

this work on server on linux ?? ( if its .dll ) ?

Could it be that you’re pressing L somehow? L turns engine on/off not only at the gas stations.

It’s a client-only script, so yes, this should work on linux server.

Great job thank you !!:thumbsup:

Did you make the fuel bar thingy go with the safezone size?

Didn’t quite get it, what did you mean?

y’know, the safezone size in the settings that move the GUI closer to the center of the screen

Well, it has relative size and position, so it will always scale with the window. I’ve never tested it with resolution less than 720p. But it should be ok.

My vehicles just shut off randomly when driving. I either have to repair it with a trainer or press L to start it again. Sometimes it shuts off as soon as you start driving, other times after a few minutes. It’s completely random.

1 Like

Can you provide me with a list of installed client plugins and server resources in DM? I’ll check if something interferes.

It’s doing it to me too, it’s as if the car just stalls pretty cool in game though but can get quite annoying. lol.

Does the fuel bar indicates the low level during this? If yes then it’s perfectly normal, it’s R*-scripted behaviour.

No we all have full fuel.