Overview
ox_fuel Expanded builds on CommunityOx ox_fuel 1.5.2. It adds hands-on gasoline fueling, electric vehicle (EV) charging, portable emergency charging, a themed checkout, and payments checked by the server. Install both included resource folders and the required sound, inventory, and interaction resources before changing vehicle settings.
Requirements
- Required
- ox_lib 3.22.0+ and ox_inventory 2.30.0+
- Interaction
- ox_target for the complete gasoline, EV, and portable workflow
- Audio
- San Andreas Sound with seven bundled OGG files installed
- Companion
- Included ox_fuel_assets 1.0.0, started before ox_fuel
- Resource names
- Keep ox_fuel and ox_fuel_assets
Installation
Install both included folders, keeping them named ox_fuel and ox_fuel_assets, and disable every competing fuel resource.
Install ox_lib 3.22.0+, ox_inventory 2.30.0+, ox_target, and San Andreas Sound.
Add the supplied portable_ev_charger item to ox_inventory and copy its compact image into ox_inventory/web/images.
Copy all seven bundled OGG files into san_andreas_sound/web/sounds.
Review fuel, payment, pump, nozzle, EV, portable, vehicle-profile, location, and Chaos Mode settings in config.lua and the data modules.
Start the resources in the documented order and perform a full server restart for the first ox_fuel_assets installation.
Configuration
Install the package and dependency baseline
Copy both packaged resources into the server, keep their folders named ox_fuel and ox_fuel_assets, and disable every competing fuel resource. The runtime checks ox_lib 3.22.0+ and ox_inventory 2.30.0+; the complete feature set also requires ox_target and San Andreas Sound.
Install the portable inventory item
Copy the portable_ev_charger definition from install/ox_inventory_items.lua into ox_inventory/data/items.lua, then copy portable_ev_charger_compact.png into ox_inventory/web/images. Keep stack false so each unit retains its own charge and deployment metadata.
['portable_ev_charger'] = {
label = 'Portable EV Charger',
weight = 12000,
stack = false,
close = true,
consume = 0,
client = {
export = 'ox_fuel.portableEvCharger',
image = 'portable_ev_charger_compact.png',
},
}Install the seven positional sounds
Copy chargestop.ogg, charging.ogg, fuelstop.ogg, pickupnozzle.ogg, putbackcharger.ogg, putbacknozzle.ogg, and refuel.ogg from ox_fuel/assets/sounds into san_andreas_sound/web/sounds. The shipped configuration addresses that resource directly and the manifest declares it as a dependency.
chargestop.ogg
charging.ogg
fuelstop.ogg
pickupnozzle.ogg
putbackcharger.ogg
putbacknozzle.ogg
refuel.oggConfigure fuel grades and checkout
The fueling table controls grade order, price per gallon, transfer rate, blend ratio, and consumption multiplier. payments controls visible Cash and Bank choices. Cash uses ox_inventory's money item; Bank auto-detects qbx_core, qb-core, or es_extended.
fueling = {
pumpGallonsPerSecond = 0.20,
canGallonsPerSecond = 0.10,
defaultGrade = 'regular',
premiumGrade = 'premium',
gradeOrder = { 'regular', 'premium' },
grades = {
regular = { octane = 87, pricePerGallon = 5.82, premiumRatio = 0.0, consumptionMultiplier = 1.00 },
premium = { octane = 93, pricePerGallon = 7.99, premiumRatio = 1.0, consumptionMultiplier = 0.90 },
},
}
payments = {
defaultMethod = 'cash',
methodOrder = { 'cash', 'bank' },
}05Register a custom payment provider
When the built-in framework bank adapters do not fit the server, register a server provider after ox_fuel starts. getBalance receives the player ID and selected method; pay must return true only after the matching amount is removed.
exports.ox_fuel:setPaymentProvider({
getBalance = function(playerId, methodId)
-- Return the available balance for this payment method.
end,
pay = function(playerId, amount, methodId)
-- Remove the amount and return true only on success.
end,
})06Tune validation and source occupancy
serverValidation bounds vehicle distance, source-to-vehicle tolerance, accepted tick variance, and the completion grace window. pumpOccupancy controls coordinate precision, four-meter default acquisition range, 15-second leases, and five-second heartbeats. Adjust these together only after testing normal hose and cable reach.
serverValidation = {
maxVehicleDistance = 6.0,
sourceVehicleTolerance = 4.0,
tickTolerance = 2,
sessionGraceMs = 10000,
}
pumpOccupancy = {
enabled = true,
maxAcquireDistance = 4.0,
leaseDurationMs = 15000,
heartbeatMs = 5000,
}07Tune nozzles, hoses, and vehicle mounts
nozzle controls the physical prop, hose reach, attachment, distance rules, fallback mount, positional audio, and debug tools. Resolution checks a model-specific profile first, then safe petrolcap or petroltank bones, then the configurable body fallback; explicit profiles may intentionally use other bones.
08Configure EV stations and portable power
electric controls the charger and connector props, Standard and Rapid pricing and transfer rates, configured EV models, battery capacities, station locations, cables, blips, audio, and synchronized damage. electric.portable controls the unique item's 12 kWh capacity, 7.2 kW display rate, purchase, placement, cable, recharge, warnings, and damage behavior.
09Add custom pumps and fleet profiles
customGasPumpLocations accepts a pump prop, vector4 location, and optional ropeLength; every prop must also be listed in pumpModels. Use vehicleProfiles for gasoline capacity and consumption, electric.vehicles for batteries, and nozzle_offsets.lua for model-specific nozzle or connector mounts.
customGasPumpLocations = {
{
prop = 'prop_gas_pump_old3',
location = vector4(442.2, -977.17, 42.69, 270.3),
ropeLength = 14.0,
},
}10Turn on Chaos Mode
chaosMode.enabled defaults to false. Beneath the master gate are running-engine hazards, hose drive-off outcomes, vintage pump flow quirks, Rapid charger faults, and portable thermal shutdowns. Chance rolls happen on the server; major events use player cooldowns and one-event session guards, and interrupted sessions settle only delivered fuel or energy.
chaosMode = {
enabled = false,
adminLogging = true,
protections = {
playerCooldownSeconds = 900,
oneMajorEventPerSession = true,
},
}How to use and test it
Fuel a gasoline vehicle
Target an available pump, choose a grade and payment method, take the nozzle to the resolved fuel-cap mount, and begin transfer. The live register reports sale, gallons, tank level, grade, and payment while the server bounds volume and cost. Remove the attached nozzle and return it to the source pump when finished.
Charge an electric vehicle
Use a configured Sentinel station with a vehicle listed in electric.vehicles. Choose Standard or Rapid and Cash or Bank, take the connector to the resolved charge port, and complete or interrupt the session through the same server-settled flow. Unlisted vehicles are treated as gasoline unless you add an electric profile.
Purchase and use portable EV power
Purchase the portable unit at an EV station, use the unique ox_inventory item to deploy it, connect it to a configured EV, then pick it up when the transfer ends. Remaining charge is stored in item metadata; recharge the deployed unit at a normal station before recovering it.
Buy, refill, and use a petrol can
Use a target-enabled fuel pump to purchase or refill the equipped WEAPON_PETROLCAN, select the grade and payment method, then use the can near a supported vehicle's resolved fuel-cap position. Can volume and premium blend are stored in item metadata and finalized by the server.
Create a nozzle or connector profile
Set nozzle.offsetDebug.enabled to true, aim at a vehicle, and run the appropriate editor command. Press G for the compact editor, use Up/Down to choose a field and Left/Right to adjust it, Backspace to inspect, then E to print and copy the ready-to-paste profile. /ox_fuel_debugcaps toggles nearby mount markers and missing-model reporting.
/ox_fuel_nozzleoffset
/ox_fuel_chargeroffset
/ox_fuel_debugcapsRestart the package safely
After the initial full restart, ox_fuel may be restarted while ox_fuel_assets remains mounted. Stop or update the companion only as part of a full server restart, then verify station props, portable metadata, pump leases, and managed sounds after reconnecting.
Use the direct gasoline fallback
When config.ox_target is false, the client registers /startfueling and maps it to E for gasoline pumps and petrol cans. EV and portable target workflows are not complete in this mode, so ox_target remains required for the advertised package.
/startfuelingPackage contents
The repository contains two installable resources plus the inventory, image, and sound files that must be placed into their host resources.
ox_fuel
Main Lua and NUI resource for gasoline fueling, EV charging, portable power, vehicle energy use, checkout, synchronization, configuration, locales, and public integration exports. Keep this folder name for existing ox_fuel integrations.
ox_fuel_assets
Version 1.0.0 companion that streams the electric charger and connector models. It owns persistent YTYP archetypes and must remain mounted while the main resource is restarted.
Manual install payloads
install/ox_inventory_items.lua and install/images contain the portable item definition and image. assets/sounds contains the seven San Andreas Sound files. These files are source copies until installed into ox_inventory and san_andreas_sound.
Transaction and state model
Server-managed transfer sessions
The server resolves configured grade or charge mode, payment balance, capacity, transfer per tick, maximum transferable volume, source reach, and final delivered ticks. Cancellation and fault paths settle only completed delivery.
Synchronized source occupancy
Fixed pumps and chargers use coordinate-based leases with acquisition distance, a 15-second default lease, five-second heartbeats, release events, and loss notifications so clients agree on source availability.
Replicated vehicle energy state
Entity(vehicle).state.fuel remains a replicated 0–100 value for ox_fuel compatibility. Gas vehicles may also carry fuelPremiumRatio from 0–1; EV models use the same percentage state with configured battery capacity and consumption.
Differences from upstream
- Baseline
- CommunityOx ox_fuel 1.5.2
- Expanded version
- 1.5.2-expanded.2
- Energy sources
- Gas pumps, fuel cans, EV stations, and portable EV power
- Vehicle mounts
- Automatic safe bones, body fallback, and 669 adapted profiles
- Public state
- Replicated 0–100 fuel plus normalized premium blend ratio
Physical and electric interaction layer
Expanded adds attached gasoline nozzles and EV connectors, hoses and cables, custom stations, synchronized damage, managed positional sound, portable energy, and model-specific branded displays.
Capacity, grade, and payment model
Class and model tank sizes, EV batteries, Regular/Premium blend state, live volume pricing, Cash/Bank checkout, and Qbox, QBCore, ESX, or custom bank adapters sit above the preserved 0–100 fuel state.
Operational limitations
Community preview distribution
The public repository currently has no tag or GitHub release. Treat main as a versioned preview snapshot, pin the tested commit for production, and review the changelog before updating.
Complete mode depends on ox_target
ox_target appears in both READMEs but not the main fxmanifest dependencies. The E-key gasoline fallback exists when target is disabled, but EV and portable interactions require the target workflow.
Later EVs require newer game builds
Suzume requires build 3570 or newer; X-Treme and Vivanite2 require 3751 or newer; E-Stride needs a build containing the Kortz Center Heist assets. Remove unavailable models from electric.vehicles or raise the server build.
Version check follows the upstream base
versionCheck currently queries communityox/ox_fuel rather than this Expanded repository. Use the Expanded repository and changelog as the update source until that checker is changed.
Updating
Preserve local configuration and data
Back up config.lua, custom locations, vehicle and electric profiles, nozzle_offsets.lua, payment bridges, and portable item data. Compare those files against the new package instead of overwriting them blindly.
Update assets only during a full restart
When ox_fuel_assets changes, stop the server, replace both folders as required, and perform a full restart. Do not stop the companion with players connected. Recheck charger props, connector models, and cleanup before reopening.
Repeat the acceptance pass
Test representative gasoline vehicles, EVs, addon models, framework accounts, custom pumps, fuel cans, portable metadata, resource restart, insufficient funds, interrupted transfers, and every enabled Chaos Mode outcome.
Licensing and provenance
GPL-3.0 community expansion
Both packaged resources include GPL-3.0 license files. This is an independent expansion of CommunityOx ox_fuel v1.5.2, not an official CommunityOx release; preserve the license, notices, attribution, and prominent modification history with redistributed copies.
CDN-Fuel assets and sounds
The companion's charger and connector models plus seven selected sounds are redistributed from the GPL-3.0 CDN-Fuel project at the revisions documented in THIRD_PARTY_NOTICES.md. CDN-Fuel runtime code is not included.
LC Fuel data
The 26 default station coordinates and original EV baseline were transcribed from LC Fuel. nozzle_offsets.lua adapts 669 active GPL-3.0 vehicle entries; LC Fuel runtime scripts and media are not required or redistributed.
Troubleshooting
The resource stops during startup
Check the console for dependency failures. ox_lib 3.22.0+, ox_inventory 2.30.0+, san_andreas_sound, and ox_fuel_assets must be started before ox_fuel; start ox_target first for the complete interaction set. Confirm both package folders retain their required names.
Targets, nozzles, or EV actions are missing
Verify ox_target is started and config.ox_target, config.nozzle.enabled, and config.electric.enabled remain true. The gasoline E-key fallback does not provide the complete physical, EV, and portable target workflows.
Fueling or charging sounds do not play
Confirm all seven OGG files were copied into san_andreas_sound/web/sounds, San Andreas Sound starts before ox_fuel, and the configured soundBaseUrl still targets cfx-nui-san_andreas_sound. Test a pickup, loop, stop, and return cue within the configured distance.
EV charger or connector models are missing
Install and ensure ox_fuel_assets before ox_fuel, then perform a full server restart. Do not repair this by live-stopping the companion; unloading its custom archetypes can crash connected clients.
An electric vehicle is treated as gasoline
The model must appear in electric.vehicles. Confirm the spawn name and required game build, then add an entry with batteryCapacityKwh and consumptionRate. Reconnect or restart the main resource after changing the profile.
A nozzle or connector mounts incorrectly
Use /ox_fuel_debugcaps to inspect the resolved mount, then enable nozzle.offsetDebug and run the gasoline or EV offset editor. Add the printed profile to nozzle_offsets.lua and verify both side handling and attachment on the exact addon model.
Bank does not appear as a payment option
The server only exposes payment methods with a readable balance. Start qbx_core, qb-core, or es_extended before the transaction, or register a custom setPaymentProvider bridge that returns balances and removes funds for the selected method.
The portable item cannot be used or retains no charge
Confirm the supplied item entry is in ox_inventory, its client export is ox_fuel.portableEvCharger, stack is false, and the image filename matches. Test purchase, deploy, partial transfer, pickup, reconnect, and recharge while inspecting the item's charge metadata.
A source remains occupied
Wait for the default lease timeout, confirm the client can send its five-second heartbeat and release events, and check source/vehicle distance limits. Repeated stale leases indicate a resource, event-routing, or cleanup problem rather than a reason to disable occupancy globally.
Unexpected damage or shutdowns occur
Check chaosMode.enabled first. The master switch defaults to false; when enabled, inspect admin logs, per-feature switches, percentages, the 900-second default player cooldown, and the one-major-event session guard before changing individual outcomes.
Reference
Vehicle fuel state
The public compatibility surface remains the replicated vehicle fuel state in the 0–100 range. Read the entity state first and fall back to the native when initializing; write authoritative changes with a replicated state-bag update.
local state = Entity(vehicle).state
local fuel = state.fuel or GetVehicleFuelLevel(vehicle)
state:set('fuel', math.clamp(newFuel, 0, 100), true)Server payment provider
setPaymentProvider is the preferred custom economy API. Pass a table containing getBalance(playerId, methodId) and pay(playerId, amount, methodId), or pass those two functions separately. pay must return true on success.
exports.ox_fuel:setPaymentProvider(provider)
exports.ox_fuel:setPaymentProvider(getBalance, pay)Legacy server payment callback
setPaymentMethod accepts a legacy charge callback receiving player ID, amount, and method ID. New bridges should use setPaymentProvider so checkout can obtain the available balance before beginning a session.
exports.ox_fuel:setPaymentMethod(function(playerId, amount, methodId)
-- Charge the account and return true on success.
end)Resolved nozzle-mount export
The client getVehicleFuelNozzleMount(vehicle) export returns the cached resolved mount used by the physical interaction layer. It may come from a model profile, safe fuel bone, or configured body fallback.
local mount = exports.ox_fuel:getVehicleFuelNozzleMount(vehicle)Portable inventory callback
portableEvCharger(data, item) is the client export referenced by the supplied ox_inventory item definition. Keep that export name aligned with the installed resource folder.
client = {
export = 'ox_fuel.portableEvCharger',
}Configuration and data files
config.lua owns runtime settings. data/stations.lua holds inherited gasoline station zones; vehicle_profiles.lua resolves tank and consumption data; electric_profiles.lua resolves configured EVs; fuel_grades.lua handles grades and blend math; nozzle_offsets.lua contains vehicle attachment profiles.
Internal callbacks and events
The ox_fuel:* callbacks and network events used for transactions, leases, destruction, sound, portable metadata, and cleanup are internal plumbing rather than a supported third-party API. Integrate through the documented exports and vehicle state.
- Version 1.5.2-expanded.2 is the manifest and changelog version on the public main branch. The repository currently has no tag or GitHub release, so pin the tested commit rather than treating an automatically generated branch archive as a release artifact.
- Keep the main resource named ox_fuel and the companion named ox_fuel_assets. A full restart is required for the first companion installation and whenever its streamed archetypes change.
- The version checker still queries communityox/ox_fuel. Follow the ox_fuel-Expanded repository and changelog for Expanded updates until that runtime target changes.
- Both packaged resources are GPL-3.0. Preserve LICENSE and THIRD_PARTY_NOTICES.md, CommunityOx attribution, CDN-Fuel asset and sound provenance, LC Fuel data provenance, and modification notices when redistributing the package.
- San Andreas Sound is the supported shipped audio path. Although legacy InteractSound-compatible code remains internally, do not substitute another provider without reviewing and adapting the current runtime.
- Do not document setMoneyCheck as a working integration hook in this snapshot: the export assigns a client function, but the active checkout path does not consume it.