Skip to content

A functionality fuel system based off of PS-Fuel that uses PolyZones that target fueling pumps and vehicles to allow you to refuel your vehicle, as well as interact-sound to play accurate refueling sounds, Syphoning, Jerry Cans and more! Converted by NoobySloth & RijayJH

License

Notifications You must be signed in to change notification settings

NoobySloth/cdn-fuel-ox

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THIS VERSION IS NO LONGER ACTIVE - PLEASE USE CDN-FUEL UP-TO-DATE WITH OX!

Codine Development Fuel Script Banner

CDN-Fuel (2.0.0 Beta)

A functionality fuel system based off of ps-fuel that uses PolyZones that target fueling pumps and vehicles to allow you to refuel your vehicle, as well as interact-sound to play accurate refueling sounds.

Disclaimer

This is the Beta version of cdn-fuel with the Player Owned Gas Stations & Electric Charging Features added. Since it is in Beta, some features may not be up to standard or include some issues. If you come across an issue, create an issue or go to our discord (located at the bottom of this read me) and explain what the problem is and we will work to get a solution as soon as possible.

Major Credits

Major shoutout to the Project Sloth team. We based this script off of their wonderful ps-fuel script. We wanted to change it up a little bit, but ended up doing a lot more than originally planned, so we though we'd release this on it's own rather than PR things. (https://github.com/Project-Sloth/ps-fuel)

Dependencies:



Codine Development Fuel Script Install Banner

Begin your installation

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.

Step 1:

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.

Step 1

Step 2:

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

explorer_8jBjdkgaeQ

Step 3:

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.

step 3


Step 4:

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:

Step4-Gif

Step 5:

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.


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. explorer_4tflJ0RowY

Next, we will move our fxmanifest.lua's entries for data_file into our new resource, and REMOVE IT from cdn-fuel.

jRtUg319mL

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.*

Step 6:

We will now be installing the Jerry Can & Syphoning Kit items into your server. You don't have to install either, but they are recommended additions. You can install them & disable them in the config, until you want to use them later on!

If you plan to not use them, you can skip this Step and Step 7!

The first step of installing our items is to navigate to your qb-core/shared/items.lua.

Once there, we will paste the following items at the bottom of our items table.

	["syphoningkit"]				 = {["name"] = "syphoningkit", 					["label"] = "Syphoning Kit", 			["weight"] = 5000, 		["type"] = "item", 		["image"] = "syphoningkit.png", 		["unique"] = true, 		["useable"] = true, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A kit made to siphon gasoline from vehicles."},
	["jerrycan"]				 	 = {["name"] = "jerrycan", 						["label"] = "Jerry Can", 				["weight"] = 15000, 	["type"] = "item", 		["image"] = "jerrycan.png", 			["unique"] = true, 		["useable"] = true, 	["shouldClose"] = false,   ["combinable"] = nil,   ["description"] = "A Jerry Can made to hold gasoline."},

For people using inventories with built-in decay, you must add those onto the item, as it doesn't come with it!

You can follow this GIF to better understand how to install the items:
Step4GIF
Now, we need to format item data in our inventory. Firstly, find the app.js located at inventoryname/html/js/app.js.

Now we will CTRL+F the following line:

} else if (itemData.name == "harness") {

Once you have found this line, copy the following one line above it:

        } else if (itemData.name == "syphoningkit") { // Syphoning Kit (CDN-Fuel or CDN-Syphoning!)
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p>" + "A kit used to syphon gasoline from vehicles! <br><br>" + itemData.info.gasamount + " Liters Inside.</p>" +
                "</span></p><p style=\"padding-top: .8vh;font-size:11px\"><b>Weight: </b>" + ((itemData.weight * itemData.amount) / 1000).toFixed(1) + " | <b>Amount: </b> " + itemData.amount
            );
        } else if (itemData.name == "jerrycan") { // Jerry Can (CDN-Fuel!)
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html(
                "<p>" + "A Jerry Can, designed to hold fuel! <br><br>" + itemData.info.gasamount + " Liters Inside.</p>" +
                "</span></p><p style=\"padding-top: .8vh;font-size:11px\"><b>Weight: </b>" + ((itemData.weight * itemData.amount) / 1000).toFixed(1) + " | <b>Amount: </b> " + itemData.amount
            );

Again, if you have decay, you must add in the options yourself!

Here is a GIF to better understand how to install the "jerrycan" and "syphoningkit" in the app.js
Step4JSGIF

Next, we'll add the item's images into our Inventory resource. This is a simple process.

Navigate to the cdn-fuel resource and follow this path: cdn-fuel/assets/images

Once there, select both images and either drag or CTRL + X and CTRL + V them into your inventory's image folder, usually the path is: inventoryname/html/images/

You can follow this GIF to get a better understanding:
Step4ImagesGIF

Step 6:

This step is only necessary for you to be able to do the /giveitem command or to put items in the qb-shops.

Navigate to inventoryname/server/server.lua, and CTRL + F the following line:

				elseif itemData["name"] == "harness" then
					info.uses = 20

Now we will add the following above the line below:
				elseif itemData["name"] == "syphoningkit" then
					info.gasamount = 0
				elseif itemData["name"] == "jerrycan" then
					info.gasamount = 0

Alternatively, watch this GIF to better understand the process:
Step6 GIF


QB-Shop Setup

Here are some preconfigured shop items if you wish to put them in the shop. (The Jerry Can is buyable via the Gas Pump!)

        [10] = {
            name = "syphoningkit",
            price = 5000,
            amount = 5,
            info = { gasamount = 0 }, -- This must be included or, your item will not store fuel properly!
            type = "item",
            slot = 10,
        }, -- CDN-Fuel / CDN-Syphoning
        [11] = {
            name = "jerrycan",
            price = 750,
            amount = 5,
            info = { gasamount = 0 }, -- This must be included or, your item will not store fuel properly!
            type = "item",
            slot = 11,
        }, -- CDN-Fuel

You will most likely have to change the slot it is in for it to work properly!

QB-Target Issue Fix

There is a possible issue with qb-target if you are using the Config.GlobalVehicleOptions or Config.TargetBones options.

If you are NOT having this issue occur, do not follow the instructions below, as it could mess up other things.


Here is a simple fix for that issue:


Firstly, this option will have to be added to your Config.TargetBones under the bones you are having trouble with:

            {
				type = "client",
				event = "cdn-fuel:client:SendMenuToServer",
				icon = "fas fa-gas-pump",
				label = "Insert Nozzle",
				canInteract = function() return Allowrefuel end
            },
	    {
				type = "client",
				action = function()
					TriggerEvent('cdn-fuel:client:electric:RefuelMenu')
				end,
				icon = "fas fa-bolt",
				label = "Insert Electric Nozzle",
				canInteract = function() return AllowElectricRefuel end
            },

Here is an example of how to add this option:

Step5part33 QB-Target
This is specifically for the "boot" bone, but, add it on which bone you are having trouble with.



Next, we'll add this simple Function & Export into our QB-Target in the Functions() area:

local function AllowRefuel(state, electric) 
    if state then
		if electric then
			AllowElectricRefuel = true
		else
        	Allowrefuel = true
		end
    else
		if electric then
			AllowElectricRefuel = false
		else
			Allowrefuel = false
		end
    end
end exports('AllowRefuel', AllowRefuel)

Example Image:

Step5 Part 421421412


Lastly, add the following to the top of your init.lua in QB-Target:

local Allowrefuel = false
local AllowElectricRefuel = false

Example Image:

Example Image

Now, set the Config.FuelTargetExport in cdn-fuel/shared/config.lua to true.


Step5 Part 1421942151251

You are now officially done installing!


Enjoy using cdn-fuel, if you have an issues, create an issue on the repository, and we will fix it ASAP!



Codine Development Fuel Script Features Banner

Some features to mention within cdn-fuel:

  • 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.
  • Menu estimating cost for vehicle being refueled. (Tax Included)
  • Fuel Nozzle 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.
  • CDN-Syphoning built-in 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.


Codine Development Fuel Script Showcase Banner

Demonstration of the script

Here's a couple of videos showcasing the script in action!



Codine Development Fuel Script Future Plans Banner

Future Plans

  • Make it work with the oil rig jobs using ps-playergroups!
  • Owners being able to hire employees.
  • Send more suggestions in our discord server!


Codine Development Links Banner

Codine Links

Credits:

Massive shoutout once again to the team at Project Sloth!

They create super sick scripts that have changed the game when it comes to fivem server development. This script is based off of their ps-fuel script.

About

A functionality fuel system based off of PS-Fuel that uses PolyZones that target fueling pumps and vehicles to allow you to refuel your vehicle, as well as interact-sound to play accurate refueling sounds, Syphoning, Jerry Cans and more! Converted by NoobySloth & RijayJH

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%