Server sided Fuel System

Animation and tracking, whether the player is near the pump, are based on LegacyFuel, while the other code is written from scratch.

Story: When I was playing on other servers, most of them used LegacyFuel. Hassle-free, deploy and forget. It’s good, right? But the fuel is not synced, even with OneSync, due to how LegacyFuel handles the fuel level. For example, your friend Bob picks you up in his brand new Blista. On Bob’s screen, his fuel level is about 50%, but on your screen, it says 15%. (Doesn’t 100% represent the problem.)

What this script does is pretty simple on the server side. So it means you can’t refill your car with vMenu or txAdmin. (Yeah, I am talking to you, admin/moderator abusing power. Don’t be lazy, seriously.)

Feature List:
• Fuel tank matters. If it pops and starts leaking, you are f*cked because it’s leaking. Get it fixed.
• Immersive out-of-fuel sequence. Originally, when the car runs out of fuel, it will start reversing. This script will shut off the engine instead of reversing like a donkey.
• Works with ox_inventory. (Q: But sir, what about other scripts? A: Replace how the script handles the Jerrycan then.)
• Extended pump for planes and boats.
• Store Fuel level in database

It’s not the best work I’ve done, but it did what I wanted.

Side Note : I made this when ox_inventory was still linden_inventory. So stop telling me why this and that. This script sits at the back of my stash for a long time.

Github

4 Likes

just curious, why not use ox_fuel ? its already use state bag

ox_fuel is the reason :joy: ditching it

1 Like

Emm LegacyFuel syncs fuel btw, and you can remain in the vehicle during refueling too and it completely matches up… maybe your using a old old version of legacy fuel

You know state bags is great and the way forward right… Unless you just don’t know know how to use them properly.

It synced but sometime they don’t and doesn’t work great. It’s optional to use this script anyway.

This is by far the best description of a script I have ever read. Nice script as well.

Updated Fixes some bugs and glitch
Compatible with latest version of ESX only.

1 Like

Thank you! This actually works with money and such…! :smiley:

But there is a error when fueling.

[      script:oxmysql] Error: esx_visioncar was unable to execute a query!
[      script:oxmysql] Query: SELECT fuel FROM owned_vehicles WHERE plate = ?
[      script:oxmysql] ["IH 12779"]
[      script:oxmysql] Unknown column 'fuel' in 'field list'

After fueling the fuel tank jumps up and down from 50% to 100% - and it goes back to half. and i can full up the tank unlimited. Probably due to the error above.

Fixed - added fuel to owned_vehicles.

Hi, is it normal that if I try to refuel NPC vehicles the system fails? rightly it cannot be found in the database, is there a way to resolve this?