Started off as my first script, and for whatever reason, I decided to release the disgusting pile of shit. Felt bad after some time for leaving so many people with this horror of a script, so ended up spending a few hours rewriting it, so here you go. (:
- Download the latest version in the "code" tab on GitHub.
- Drag & drop the folder into your
resourcesserver folder. - Configure the config file to your liking.
- Add
start LegacyFuelto your server config.
There are currently two (client-sided) exports available, which should help you control the fuel level for vehicles whenever needed.
SetFuel(--[[Vehicle--]] vehicle, --[[Float/Int: (0-100)--]] value)
GetFuel(--[[Vehicle--]] vehicle) -- Returns the vehicle's fuel level.
Example usage:
function SpawnVehicle(modelHash)
local vehicle = CreateVehicle(modelHash, coords.x, coords.y, coords.z, true, false)
exports["LegacyFuel"]:SetFuel(vehicle, 100)
end
function StoreVehicleInGarage(vehicle)
local plate = GetVehicleNumberPlateText(vehicle)
local fuelLevel = exports["LegacyFuel"]:GetFuel(vehicle)
TriggerServerEvent('vehiclesStored', plate, fuelLevel)
end