overextended / ox_fuel

Simplistic fuel resource meant for use with ox_inventory
https://overextended.dev/ox_fuel
GNU General Public License v3.0
60 stars 77 forks source link

sync fuel across clients #16

Closed StuxxyOfficial closed 2 years ago

StuxxyOfficial commented 2 years ago

syncs fuel across clients use following export wherever you need to get fuel level of a vehicle - exports['ox_fuel']:GetFuel(currentVehicle)

thelindat commented 2 years ago

The getfuel exports are kind of weird, and sending server event to set fuel when client statebag is replicated anyway.

Check fuel state when entering car, if nil then initialise on server (there’s a bug that will prevent unit from client). Fuel should always be checked with statebag and not some abstraction via export.

StuxxyOfficial commented 2 years ago

set fuel event was mainly just there for people who couldn't quite grasp how to use statebags properly lol... we can change it so it doesn't send the server event at all to init the fuel, i just thought that was a better option is all and yeah again exports were just there to be a bit more user-friendly, also been using this setup for about a week on live server with no issues.

thelindat commented 2 years ago

I’d like to see people learn how to use statebags rather than hide it behind an export that doesn’t even save them time.