Overview
SG-Fuel is an advanced fuel management script that provides seamless compatibility with both qb-fuel and LegacyFuel. Choose between traditional qb-fuel consumption mechanics or the more realistic RPM-based consumption system from LegacyFuel, all while enjoying a sleek, modern user interface.
Features
Core Features
- Dual Consumption Systems
- Enhanced Modern NUI
- Full Export Compatibility
- Player-Owned Gas Stations
Fuel Management
- Jerry Cans
- Emergency Refuel
- Custom Fuel Pricing
- Fuel Ordering
Exports
SG-Fuel provides the same exports as both LegacyFuel and qb-fuel:
-- Get vehicle fuel level (0-100)
local fuel = exports['sg-fuel']:GetFuel(vehicle)
-- or for LegacyFuel compatibility
local fuel = exports['LegacyFuel']:GetFuel(vehicle)
-- or for qb-fuel compatibility
local fuel = exports['qb-fuel']:GetFuel(vehicle)
-- Set vehicle fuel level (0-100)
exports['sg-fuel']:SetFuel(vehicle, amount)
-- or for LegacyFuel compatibility
exports['LegacyFuel']:SetFuel(vehicle, amount)
-- or for qb-fuel compatibility
exports['qb-fuel']:SetFuel(vehicle, amount)Dependencies
Required
qb-core- QBCore Frameworkoxmysql- MySQL wrapper
Optional
qb-targetorox_targetox_lib(for notifications)
Installation
Download & Place
Download the resource and place it in your resources folder
Rename Folder
Rename the folder to sg-fuel (important for compatibility)
Import Database Tables
Import the database tables from install/jobs.lua if needed
Choose Optional Dependencies
Install if desired:
- -
ox_lib- If you want to use ox_lib notifications - -
qb-targetorox_target- If you want to use target interaction instead of 3D text
Configure
Configure the script in config.lua to your preferences:
- - Set
Config.NotificationProviderto 'qb' or 'ox_lib' - - Set
Config.VehicleInteractionMethodto 'target' or '3dtext'
Add to server.cfg
ensure sg-fuelConfiguration
Provider Auto-Detection
SG-Fuel automatically detects your installed resources:
- - Target System: Automatically detects and uses either
qb-targetorox_target - - Notifications: Configure to use either
qb-coreorox_libnotifications
No additional setup required - just install your preferred resources and configure in config.lua!
Fuel Consumption Modes
Choose your preferred fuel consumption system:
-- Use RPM-based consumption (LegacyFuel style)
Config.UseLegacyFuelConsumption = true
-- Or use qb-fuel style consumption
Config.UseLegacyFuelConsumption = falseKey Configuration Options
Config.FuelPrice = 50 -- Price per liter
Config.Currency = 'R' -- Currency symbol
Config.SyncFuelBetweenPlayers = true -- Enable fuel sync
Config.ShowNearestGasStationOnly = true -- Smart blip systemNotification Provider
Choose between QBCore or ox_lib notifications:
Config.NotificationProvider = 'qb' -- Options: 'qb' or 'ox_lib'
Config.NotificationPosition = 'left-center' -- Notification position on screenPosition Options: 'left-center', 'right-center', 'top-center', 'bottom-center', 'top-left', 'top-right', 'bottom-left', 'bottom-right'
Note: Position names are automatically mapped between qb-core and ox_lib formats. Just use the qb-core format names, and they will work with both notification systems!
Interaction Method
Choose your preferred interaction system:
Config.VehicleInteractionMethod = '3dtext' -- Options: 'target' or '3dtext'
-- If using 'target', the script automatically detects qb-target or ox_targetNote: The script automatically detects which target resource you have installed (qb-target or ox_target). No additional configuration needed!
Emergency Refuel
Configure the emergency refuel system for gas station employees:
Config.EmergencyRefuel = {
Enabled = true,
RequireEmployeeJob = true,
MaxDistance = 5.0,
Command = 'emergencyrefuel',
}Player-Owned Stations
Set up business ownership for each gas station:
Config.GasStations = {
[vector3(49.4187, 2778.793, 58.043)] = 'express1',
[vector3(263.894, 2606.463, 44.983)] = 'express1',
-- Add more stations...
}Commands
/emergencyrefuel- Gas station employees can refuel nearby vehicles/emergencyrefuelhelp- Display emergency refuel help
Important Notes
- DO NOT RESTART the script while the server is running - it will break compatibility with other resources. Players will need to reconnect.
- DO NOT RENAME the resource folder from
sg-fuel- this will break functionality - If you encounter issues after breaking these rules, restart the entire server
Compatibility
This script is designed to work seamlessly with:
Export Compatibility
- - Resources calling LegacyFuel exports
- - Resources calling qb-fuel exports
Framework & Integrations
- - QBCore framework (required)
- - qb-target or ox_target (optional - required only if using 'target' interaction method)
- - ox_lib (optional - required only if using 'ox_lib' as notification provider)
- - sg-loadshedding (optional - for power outage integration)
Credits
- - Original Base: qb-fuel
- - Enhanced By: sgMAGLERA
- - Combines Features From: LegacyFuel & qb-fuel
Support
For support, please ensure you:
- Have not renamed the resource
- Have not restarted the script mid-session
- Have correctly configured the
config.lua - Have all required dependencies