Client
Here you'll find all client functions
How to set/get fuel?
First you need to retrieve the vehicle entity handle (with ox_lib cache.vehicle
)
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed, false)
Then you need to set the statebag for get/set the fuel
-- previous locals to get the vehicle entity
Entity(vehicle).state.fuel
Now you can get or set the value of the Statebag in this ways
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed, false)
local fuel = Entity(vehicle).state.fuel
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed, false)
Entity(vehicle).state.fuel = 100
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed, false)
Entity(vehicle).state:set("fuel", 100, true)