A highly in-depth fuel system for FiveM with support for the ESX.
Fixes:
- General Fixes
- Show all gas station blips via Config Options.
- Vehicle blowing up chance percent via Config Options.
- Pump Explosion Chance when running away with Nozzles via Config Options.
- Global Tax and Fuel Prices via Config Options.
- Target eye for all base fuel actions, not including Jerry Can & Syphoning.
- Fuel and Charging Nozzle with realistic animations.
- Custom sounds for every action, like refueling & charging.
- Select amount of fuel you want to put in your vehicle.
- On cancel, the amount you put in will be filled.
- Option to pay cash or with your bank.
- Toggleable Jerry Cans via Config Options.
- Electric Charging with a Custom Model & pre-configured locations.
- Player Owned Gas Stations that can be maintained by the Owner.
- Highly User Friendly Menus for Gas Station Owners.
- Reserve Levels which are maintained by the Owner of the Gas Station or Unlimited based on Config Options.
- Renamable Gas Stations on Map with Blacklisted words.
- Helicopter and Boat Refueling.
- Configurable discounts for Emergency Services.
- Configurable Hose for the Fuel Nozzle.
- Official Support for the OX Library. (Inventory/Menus/Target)
Make sure you have the following dependencies, otherwise, issues most likely will arise:
- ox-target
- ox_lib
- interact-sound
- PolyZone
- Other dependencies are included in the resource.
Here, we shall provide a step-by-step guide on installing cdn-fuel to your server and making it work with other scripts you may already have installed.
First, we will start by renaming the resource "cdn-fuel-main" to just "cdn-fuel".
Next, we will drag the "cdn-fuel" resource into your desired folder in your servers resources directory.
Next, we're going to drag the sounds from the cdn-fuel/assets/sounds folder in cdn-fuel, into your interact-sounds folder located at resources/[standalone]/interact-sound/client/html/sounds
Next, we're going to open our entire resources folder in whichever IDE you use, (we will be using Visual Studio Code for this example) and replace all of your current exports titled "LegacyFuel", "ps-fuel" or "lj-fuel", with "cdn-fuel". Then you want to ensure cdn-fuel in your server's config file.
Next, we're going to run our SQL file, which is needed if we want to use the Player Owned Gas Stations, otherwise you do not have to run it.
The file you need to run is located @ cdn-fuel/assets/sql/cdn-fuel.sql
Here is a GIF to run you through the process of running an SQL file:
It is highly recommended, if you plan on restarting the script at all, that you move the stream folder & data_file paramaters found in the fxmanifest.lua to another resource for the time being. If you do not do this, you & anyone in the server's game will most likely crash when restarting cdn-fuel. The process is very simple & it is outlined in the GIF & Instructions below.
Copy and paste the jerrycan item to items.lua
['jerrycan'] = {
label = 'Jerrycan',
client = {
event = 'cdn-fuel:jerrycan:refuelmenu',
}
},
Firstly, we will move our stream folder to our new resource, or existing resource.
In this example, I have a dummy resource named cdn-fool.
Next, we will move our fxmanifest.lua's entries for data_file into our new resource, and REMOVE IT from cdn-fuel.
data_file 'DLC_ITYP_REQUEST' 'stream/[electric_nozzle]/electric_nozzle_typ.ytyp'
data_file 'DLC_ITYP_REQUEST' 'stream/[electric_charger]/electric_charger_typ.ytyp'
Make sure to ensure this new resource as well as cdn-fuel in your server.cfg!
If you do not want the Jerry Can or Syphoning Kit items, you are now finished with installation.
*Otherwise, navigate to Step 6 & Step 7 below, and finish installation.*
We highly recommend you add the following snippet to your engine toggle command. It will make it to where players cannot turn their vehicle on if they have no fuel! Seems pretty important to us!
-- EXAMPLE FOR QB-VEHICLEKEYS, FUNCTION ToggleEngine();
local NotifyCooldown = false
function ToggleEngine(veh)
if veh then
local EngineOn = GetIsVehicleEngineRunning(veh)
if not isBlacklistedVehicle(veh) then
if HasKeys(QBCore.Functions.GetPlate(veh)) or AreKeysJobShared(veh) then
if EngineOn then
SetVehicleEngineOn(veh, false, false, true)
else
if exports['cdn-fuel']:GetFuel(veh) ~= 0 then
SetVehicleEngineOn(veh, true, false, true)
else
if not NotifyCooldown then
RequestAmbientAudioBank("DLC_PILOT_ENGINE_FAILURE_SOUNDS", 0)
PlaySoundFromEntity(l_2613, "Landing_Tone", PlayerPedId(), "DLC_PILOT_ENGINE_FAILURE_SOUNDS", 0, 0)
NotifyCooldown = true
QBCore.Functions.Notify('No fuel..', 'error')
Wait(1500)
StopSound(l_2613)
Wait(3500)
NotifyCooldown = false
end
end
end
end
end
end
end
Enjoy using cdn-fuel, if you have an issues, create an issue on the repository, and we will fix it ASAP!
Here's a couple of videos showcasing the script in action!
- ESX Conversion: Shorty