JG Scripts Docs
DiscordSupportStore
  • Welcome!
  • Claim Purchase
  • FiveM Escrow Errors
  • Permissions Troubleshooting
  • Translations
  • 🛠️Mechanic
    • Introduction
    • Installation & Configuration
      • ox_inventory
      • qb-inventory
      • esx_inventory
      • Setup New Mechanic Location
    • Job Setup
      • ESX Framework Jobs
    • Inventory Items
    • Props
    • Tuning
    • Manual Transmissions & Smooth First Gear
    • Integrations
    • Commands, Events & Exports
      • Commands
      • Events
      • Exports
    • Changelog
      • v1.3.0
      • v1.2.0
      • v1.1.3
      • v1.1.2
      • v1.1.1
      • v1.1
      • v1.0.12
      • v1.0.11
      • v1.0.10
      • v1.0.9
      • v1.0.8
      • v1.0.7
      • v1.0.6
      • v1.0.5 - hotfix
      • v1.0.5
      • v1.0.4
      • v1.0.3
      • v1.0.2
      • v1.0.1
  • 🚘Dealerships
    • Introduction
    • Installation & Configuration
    • Advanced Configuration
    • Job Dealership Setup
    • License Check
    • Importing Vehicles
    • Dealership Locations
    • Employees
    • Custom Payment Options
    • Plate Format
    • Vehicle Images
    • Languages
    • Commands, Events & Exports
      • Commands
      • Events
    • Integrations
      • Quasar Garages
      • Pickle Mods Documents
      • okokContract
      • qb-vehiclesales
    • Changelog
      • v1.4.0
      • v1.3.1
      • v1.3.0
      • v1.2.6
      • v1.2.5
      • v1.2.4
      • v1.2.3
      • v1.2.2
      • v1.2.1
      • v1.2
      • v1.1.9
      • v1.1.8
      • v1.1.7
      • v1.1.6
      • v1.1.5
      • v1.1.4
      • v1.1.3
      • v1.1.2
      • v1.1.1
      • v1.1
      • v1.0.3
      • v1.0.2
      • v1.0.1
  • 🚗Advanced Garages v3
    • Introduction
    • Installation & Configuration
    • Migration from v1
    • Public, Private & Impound Garages
    • Job & Gang Garages
    • Transferring Vehicles
    • Vehicle Duplication Prevention
    • Vehicle Images
    • Languages
    • Commands, Events & Exports
      • Commands
      • Events
      • Exports
    • Misc
      • Spawn Vehicles with ServerSetter
      • Why are you not using CreateVehicleServerSetter by default?
    • Troubleshooting
      • Execution of native... SetDriftTyresEnabled error
      • ucrtbase.dll!strcmp crash
      • SQL error: foreign key constraint fails
    • Integrations
      • qb-phone
      • npwd
      • RoadPhone
      • Quasar Smartphone
      • Quasar Housing
      • okokDeleteVehicles
      • ps-housing
      • nolag_properties
      • Brazzers-FakePlate
      • Custom Fuel System
      • Custom Key System
    • Guides
      • ESX Guides
        • Vehicle Labels
      • QBCore Guides
        • Why isn't /admincar working?!
        • Liveries not saving
    • Changelog
      • v3.2.1
      • v3.2.0
      • v3.1.6
      • v3.1.5
      • v3.1.4
      • v3.1.3
      • v3.1.2
      • v3.1.1
      • v3.1.0
      • v3.0.8
      • v3.0.7
      • v3.0.6
      • v3.0.5
      • v3.0.4
      • v3.0.3
      • v3.0.2
      • v3.0.1
      • v3
      • v2.2.9
      • v2.2.8
      • v2.2.7
      • v2.2.6
      • v2.2.5
      • v2.2.4
      • v2.2.3
      • v.2.2.2
      • v2.2.1
      • v2.2.0
      • v2.1.2
      • v2.1.1
      • v2.1
      • v2.0.7
      • v2.0.6
      • v2.0.5
      • v2.0.4
      • v2.0.3
      • v2.0.2
      • v2.0.1
  • 📊Handling
    • Introduction
    • Installation
    • Exports
  • 🎮Pro Scoreboard
    • Introduction
    • Installation
    • Config & Customisation
  • Advanced Garages v1
    • QB Installation & Config
    • ESX Installation & Config
Powered by GitBook
On this page
  • Part 1: Configuration
  • Part 2: Adding get/removal code for the payment option

Was this helpful?

Edit on GitHub
  1. Dealerships

Custom Payment Options

Last updated 3 months ago

Was this helpful?

Available in Dealerships v1.4 and newer.

You can now add custom payment options to Dealerships, so no longer will players only have the option to use either cash or their bank balance. You could add black money, VIP coins, cryptocurrencies, or whatever! You can add code for whatever you'd like. Let your imagination run wild! This tutorial is split into two parts; the first part is how to update the config files, and the second part explains how you can add code for fetching and deducting from your custom payment option.

We will add an option called waterin this example with the use of Ox Inventory.

Part 1: Configuration

  1. Find the dealership you want to add another payment option to.

  2. Add this into the dealership

paymentOptions = {"cash", "bank", "NewOption"},
  1. In this example we'll add water. So we change NewOption to water

paymentOptions = {"cash", "bank", "water"},
  1. Then we need to go into our language file and add a translation for water

water = "Water",
  1. It should now show in the dealership's payment options!

Part 2: Adding get/removal code for the payment option

Now we need to add some code to our framework files to tell JG Dealerships where to fetch the value of water and how to deduct from it.

  1. Find the Framework.Client.GetBalance function located in framework/cl-functions.lua

  2. In the first line we need to change "custom" to "water". Then we need to add our functionality to retrieve and return the amount of water which the client has

if type == "water" then
    return exports.ox_inventory:GetItemCount("water")
    -- Add your own custom balance system here insted (eg: return 0)
elseif Config.Framework == "QBCore" then
  1. Now go to sv-functions.lua and find Framework.Server.GetPlayerBalance

  2. Then we need to do the exact same as we did in the cl-functions.lua. change "custom" to "water" and return the correct amount of water

if type == "water" then
    return exports.ox_inventory:GetItemCount(src, "water")
    -- Add your own custom balance system here instead (eg: return 0)
elseif Config.Framework == "QBCore" or Config.Framework == "Qbox" then
  1. Go down to Framework.Server.PlayerRemoveMoney

  2. Change "custom" to "water" again and now we need to create code for the removal of water

if account == "water" then
    exports.ox_inventory:RemoveItem(src, "water", amount)
    -- Add your own custom balance system here instead
elseif Config.Framework == "QBCore" or Config.Framework == "Qbox" then

And then you're all set!

🚘