I welcome you CFX community!
Today i present to you a fuel system categorized by vehicle types that will bring more diversity to the gameplay on your server. I am confident that you and your players will find it appealing!
This system boasts a user-friendly interface that showcases various fuel options for different types of cars. In addition, it features a distinct fuel consumption mechanism within each vehicle and much more.
Demonstration of the system:
Example of a configuration file:
Configuration files
-- /*
-- ██████╗░██╗░░░██╗██████╗░███████╗██╗░░░██╗███████╗░██████╗████████╗███╗░░██╗██╗██╗░░██╗
-- ██╔══██╗██║░░░██║██╔══██╗██╔════╝██║░░░██║██╔════╝██╔════╝╚══██╔══╝████╗░██║██║██║░██╔╝
-- ██████╦╝██║░░░██║██████╔╝█████╗░░╚██╗░██╔╝█████╗░░╚█████╗░░░░██║░░░██╔██╗██║██║█████═╝░
-- ██╔══██╗██║░░░██║██╔══██╗██╔══╝░░░╚████╔╝░██╔══╝░░░╚═══██╗░░░██║░░░██║╚████║██║██╔═██╗░
-- ██████╦╝╚██████╔╝██║░░██║███████╗░░╚██╔╝░░███████╗██████╔╝░░░██║░░░██║░╚███║██║██║░╚██╗
-- ╚═════╝░░╚═════╝░╚═╝░░╚═╝╚══════╝░░░╚═╝░░░╚══════╝╚═════╝░░░░╚═╝░░░╚═╝░░╚══╝╚═╝╚═╝░░╚═╝*/
Config = {}
Config.framework = exports["es_extended"]:getSharedObject() --ESX | QBCore -> exports['qb-core']:GetCoreObject()
payFuel = function(fuelPrice, input, vehType) --Set up your framework here.
--ESX
local player = Config.framework.GetPlayerFromId(source)
if player.getMoney() >= tonumber(fuelPrice) then
player.removeMoney(fuelPrice)
TriggerClientEvent('bur_fuelsystem:refuel', source, input, vehType)
else
TriggerClientEvent('bur_fuelsystem:burExitUI', source)
TriggerClientEvent('esx:showNotification', source, Config.Translation['nomoney'])
end
--QBCore
--local player = Config.framework.Functions.GetPlayer(source)
--if player.PlayerData.money["cash"] >= tonumber(fuelPrice) then
--player.Functions.RemoveMoney('cash', fuelPrice, "Bank depost")
--TriggerClientEvent('bur_fuelsystem:refuel', source, input, vehType)
--else
-- TriggerClientEvent('bur_fuelsystem:burExitUI', source)
-- TriggerClientEvent("QBCore:Notify", source, Config.Translation['nomoney'], "success", 2500)
--end
end
-- Use Burevestnik Interaction Button (https://forum.cfx.re/t/free-standalone-interaction-button/4860169)
Config.UseBurevestnikInteractionButton = false
DisplayHelpText = function(str)
SetTextComponentFormat("STRING")
AddTextComponentString(str)
DisplayHelpTextFromStringLabel(0, 0, false, -1)
end
HelpNotificationBottom = function(text)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(text)
EndTextCommandThefeedPostTicker(true, true)
end
Config.ObjeFuel = {-2007231801, 1339433404, 1694452750, 1933174915, -462817101, -469694731, -164877493}
Config.FuelOpenButton = 38
Config.interactionDistance = 4.0
Config.Translation = {
['menu'] = 'Press ~INPUT_CONTEXT~ to ~g~interact',
['nomoney'] = '~r~You do not have enough Money!',
['noaccess'] = '~g~Your vehicle tank is full!',
['wrongtypeoffuel'] = '~r~Incorrect fuel type!',
['BurevestnikInteractionButton'] = 'E',
['BurevestnikInteractionButtonText'] = 'Press to interact',
['UIexit'] = 'EXIT',
['UIgs1'] = 'GAS STATION',
['UIgs1name'] = 'Burevestnik OIL',
['UIfuel1'] = 'Regular',
['UIfuel2'] = 'Premium',
['UIfuel3'] = 'Diesel',
['UIfuel4'] = 'ECO',
['UIgs1text1'] = 'PRICE PER GALLON',
['UIcost'] = 'COST',
['UIfueltypetext'] = 'Your fuel type',
['UIfueltypetitletext'] = 'Cash',
['UIfueltypetext2'] = 'Processing...',
['UIgs1pay'] = 'PAY AND REFUEL',
['UIgs2'] = 'ELECTRIC CHARGING',
['UIgs2name'] = 'Burevestnik STATION',
['UIgs2text1'] = 'PRICE PER KW',
['UIgs2pay'] = 'CONNECT THE CHARGER AND PAY',
['UIcurrency'] = '$',
['UIbar'] = 'Fueling in progress...',
}
Config.useFuelConsumption = true
vehicleFuelConsumption = function(playerPed, vehicle)
if GetVehicleFuelLevel(vehicle) > 0 then
SetVehicleFuelLevel(vehicle, GetVehicleFuelLevel(vehicle) - (GetVehicleEstimatedMaxSpeed(vehicle)/1000))
end
end
Config.useSpecificfuel = true
Config.classes = {
{
vehicleClass = {1,2,3,4,8,9,13,18},
fuelType = "regular",
},
{
vehicleClass = {5,6,7},
fuelType = "premium",
},
{
vehicleClass = {10,11,12,14,15,16,17,19,20,21,22},
fuelType = "disel",
}
}
Config.electricVehicles = {
"Voltic",
"Voltic2",
"Dilettante",
"Dilettante2",
"Cyclone",
"Cyclone2",
"Raiden"
}
Config.regularFuelPrice = 1
Config.premiumFuelPrice = 2
Config.diselFuelPrice = 3
Config.ecoFuelPrice = 4
Config.GasStationsBlips = {
{
useBlip = true,
blipID = 415, --Blip ID.
blipScale = 0.6, --Blip scale.
blipColor = 51, --Blip color.
blipDisplay = 4, --Blip display.
blipText = "Gas station", --Blip text.
location = {
vector3(49.4187, 2778.793, 58.043),
vector3(263.894, 2606.463, 44.983),
vector3(1039.958, 2671.134, 39.550),
vector3(1207.260, 2660.175, 37.899),
vector3(2539.685, 2594.192, 37.944),
vector3(2679.858, 3263.946, 55.240),
vector3(2005.055, 3773.887, 32.403),
vector3(1687.156, 4929.392, 42.078),
vector3(1701.314, 6416.028, 32.763),
vector3(179.857, 6602.839, 31.868),
vector3(-94.4619, 6419.594, 31.489),
vector3(-2554.996, 2334.40, 33.078),
vector3(-1800.375, 803.661, 138.651),
vector3(-1437.622, -276.747, 46.207),
vector3(-2096.243, -320.286, 13.168),
vector3(-724.619, -935.1631, 19.213),
vector3(-526.019, -1211.003, 18.184),
vector3(-70.2148, -1761.792, 29.534),
vector3(265.648, -1261.309, 29.292),
vector3(819.653, -1028.846, 26.403),
vector3(1208.951, -1402.567,35.224),
vector3(1181.381, -330.847, 69.316),
vector3(620.843, 269.100, 103.089),
vector3(2581.321, 362.039, 108.468),
vector3(176.631, -1562.025, 29.263),
vector3(-319.292, -1471.715, 30.549),
vector3(-722.6, -1472.88, 5.01),
vector3(1784.324, 3330.55, 41.253)
}
},
}
--Exports
--exports.Burevestnik_fuelsystem:Burevestnik_fuelsystem_getFuel()
--exports.Burevestnik_fuelsystem:Burevestnik_fuelsystem_setFuel(amount) -- 1.0/5.7/24.4 etc
Optimization (The script consumes):
0.00 ms in a quiet state.
0.03 ms in an active state.
What does this system include:
- This system works on all versions of ESX, QBCore, as well as STANDALONE!
- Detailed configuration file!
- Beautiful user interface!
- Unique fuel consumption system for each vehicle!
- Support for our [FREE][Standalone] Interaction Button | Text UI resource !
- You can change the price for a different type of fuel!
- Ability to select the required type of fuel depending on the type of car!
- The ability to link the gas station location to the object!
- There are more than 20 preset refueling locations, and it’s also easy to add new ones!
- Exports are available!
- Of course support, I’m ready to help you!
TOP SALES
You may also be interested in my other resources:
Code accessible | Open source: Yes \ Escrow: No - Available only: config, ui |
Subscription based | No |
Lines (approximately) | ~1600 |
Requirements | Standalone/ESX/QBCore |
Support | Yes |