HSC

Snippet Dashboard

Version: 1.0.6

Integrations

Using Wasabi Banking with JG Mechanic

JG-MechanicWasabiBankingJG-Scripts

Framework

QBCore

Updated

3/13/2026

Author

HSC

Overview

Adding Wasabi-Banking to JG-Mechanic, a simple task and easy to use.

Folder/Files we will edit

The file we are editing is located in framework/sv-functions and in the config.lua

What to edit

1

In you config.lua go to line 11 [Config.SocietyBanking] add in wasabi_banking.

2

Head over to your framework folder then sv-fuctions.lua

3

Locate the Society Funds section and replace it with Snippet below

Requirements

wasabi_banking installed
JG-Mechanic V1.6.6 or higher
VSC [Visual Studio Code] to well...edit the code XD

Notes

This is currently working on 3 of my current rp servers.
This snippet was made on qbcore but should work with esx and qbox too!
Always back up the original file before replacing banking logic.

F.A.Q

Q: This isnt working!
A: You likely added it in the wrong location.

--socity funds

sv-functions.lua

lua
--
-- Society Funds
--

local usingNewQBBanking = GetResourceState("qb-banking") == "started" and
    tonumber(string.sub(GetResourceMetadata("qb-banking", "version", 0), 1, 3)) >= 2

local function _wb()
  return GetResourceState('wasabi_banking') == 'started' and exports['wasabi_banking'] or nil
end

local function _safe(call, ...)
  local ok, res = pcall(call, ...)
  if not ok then
    print(('[jg-mechanic:wasabi] error: %s'):format(res))
    return nil
  end
  return res
end

---@param society string
---@param societyType "job"|"gang"
---@return number balance
---@async
function Framework.Server.GetSocietyBalance(society, societyType)
  if Config.SocietyBanking == "okokBanking" then
    return exports["okokBanking"]:GetAccount(society)
  elseif Config.SocietyBanking == "fd_banking" then
    return exports.fd_banking:GetAccount(society)
  elseif Config.SocietyBanking == "tgg-banking" then
    return exports["tgg-banking"]:GetSocietyAccountMoney(society)
  elseif Config.SocietyBanking == "wasabi_banking"
      or (Config.SocietyBanking == "auto" and GetResourceState("wasabi_banking") == "started") then
    if GetResourceState("wasabi_banking") ~= "started" then return 0 end
    local ok, bal = pcall(function()
      return exports["wasabi_banking"]:GetAccountBalance(society, "society")
    end)
    return tonumber(ok and bal or 0) or 0
  elseif (Config.Framework == "Qbox" and Config.SocietyBanking == "auto") or Config.SocietyBanking == "Renewed-Banking" then
    return exports["Renewed-Banking"]:getAccountMoney(society)
  elseif (Config.Framework == "QBCore" and Config.SocietyBanking == "auto")
      or Config.SocietyBanking == "qb-banking"
      or Config.SocietyBanking == "qb-management" then
    local usingNewQBBanking =
        GetResourceState("qb-banking") == "started"
        and tonumber(string.sub(GetResourceMetadata("qb-banking", "version", 0) or "0", 1, 3)) >= 2

    if Config.SocietyBanking == "qb-banking" or usingNewQBBanking then
      return exports["qb-banking"]:GetAccountBalance(society)
    else
      if societyType == "job" then
        return exports["qb-management"]:GetAccount(society)
      elseif societyType == "gang" then
        return exports["qb-management"]:GetGangAccount(society)
      end
    end
  elseif (Config.Framework == "ESX" and Config.SocietyBanking == "auto") or Config.SocietyBanking == "esx_addonaccount" then
    local balance = promise.new()
    TriggerEvent("esx_society:getSociety", society, function(data)
      if not data then return balance:resolve(0) end
      TriggerEvent("esx_addonaccount:getSharedAccount", data.account, function(account)
        balance:resolve(account.money or 0)
      end)
    end)
    return Citizen.Await(balance)
  end

  return 0
end

lib.callback.register("jg-mechanic:server:get-society-balance", function(_, society, type)
  return Framework.Server.GetSocietyBalance(society, type)
end)

---@param societyName string
---@param societyType "job"|"gang"
---@param amount number
function Framework.Server.PayIntoSocietyFund(societyName, societyType, amount)
  if Config.SocietyBanking == "okokBanking" then
    exports["okokBanking"]:AddMoney(societyName, amount)
  elseif Config.SocietyBanking == "fd_banking" then
    exports.fd_banking:AddMoney(societyName, amount)
  elseif Config.SocietyBanking == "tgg-banking" then
    exports["tgg-banking"]:AddSocietyMoney(societyName, amount)
  elseif Config.SocietyBanking == "wasabi_banking"
      or (Config.SocietyBanking == "auto" and GetResourceState("wasabi_banking") == "started") then
    if GetResourceState("wasabi_banking") ~= "started" then return end
    pcall(function()
      exports["wasabi_banking"]:AddMoney("society", societyName, amount, "jg_mechanic_income")
    end)
  elseif (Config.Framework == "Qbox" and Config.SocietyBanking == "auto") or Config.SocietyBanking == "Renewed-Banking" then
    exports["Renewed-Banking"]:addAccountMoney(societyName, amount)
  elseif (Config.Framework == "QBCore" and Config.SocietyBanking == "auto")
      or Config.SocietyBanking == "qb-banking"
      or Config.SocietyBanking == "qb-management" then
    local usingNewQBBanking =
        GetResourceState("qb-banking") == "started"
        and tonumber(string.sub(GetResourceMetadata("qb-banking", "version", 0) or "0", 1, 3)) >= 2

    if Config.SocietyBanking == "qb-banking" or usingNewQBBanking then
      exports["qb-banking"]:AddMoney(societyName, amount)
    else
      if societyType == "job" then
        exports["qb-management"]:AddMoney(societyName, amount)
      elseif societyType == "gang" then
        exports["qb-management"]:AddGangMoney(societyName, amount)
      end
    end
  elseif (Config.Framework == "ESX" and Config.SocietyBanking == "auto") or Config.SocietyBanking == "esx_addonaccount" then
    TriggerEvent("esx_society:getSociety", societyName, function(society)
      if not society then return end
      TriggerEvent("esx_addonaccount:getSharedAccount", society.account, function(account)
        account.addMoney(amount)
      end)
    end)
  end
end

---@param societyName string
---@param societyType "job"|"gang"
---@param amount number
function Framework.Server.RemoveFromSocietyFund(societyName, societyType, amount)
  if Config.SocietyBanking == "okokBanking" then
    exports["okokBanking"]:RemoveMoney(societyName, amount)
  elseif Config.SocietyBanking == "fd_banking" then
    exports.fd_banking:RemoveMoney(societyName, amount)
  elseif Config.SocietyBanking == "tgg-banking" then
    exports["tgg-banking"]:RemoveSocietyMoney(societyName, amount)
  elseif Config.SocietyBanking == "wasabi_banking"
      or (Config.SocietyBanking == "auto" and GetResourceState("wasabi_banking") == "started") then
    if GetResourceState("wasabi_banking") ~= "started" then return end
    pcall(function()
      exports["wasabi_banking"]:RemoveMoney("society", societyName, amount, "jg_mechanic_expense")
    end)
  elseif (Config.Framework == "Qbox" and Config.SocietyBanking == "auto") or Config.SocietyBanking == "Renewed-Banking" then
    exports["Renewed-Banking"]:removeAccountMoney(societyName, amount)
  elseif (Config.Framework == "QBCore" and Config.SocietyBanking == "auto")
      or Config.SocietyBanking == "qb-banking"
      or Config.SocietyBanking == "qb-management" then
    local usingNewQBBanking =
        GetResourceState("qb-banking") == "started"
        and tonumber(string.sub(GetResourceMetadata("qb-banking", "version", 0) or "0", 1, 3)) >= 2

    if Config.SocietyBanking == "qb-banking" or usingNewQBBanking then
      exports["qb-banking"]:RemoveMoney(societyName, amount)
    else
      if societyType == "job" then
        exports["qb-management"]:RemoveMoney(societyName, amount)
      elseif societyType == "gang" then
        exports["qb-management"]:RemoveGangMoney(societyName, amount)
      end
    end
  elseif (Config.Framework == "ESX" and Config.SocietyBanking == "auto") or Config.SocietyBanking == "esx_addonaccount" then
    TriggerEvent("esx_society:getSociety", societyName, function(society)
      if not society then return end
      TriggerEvent("esx_addonaccount:getSharedAccount", society.account, function(account)
        account.removeMoney(amount)
      end)
    end)
  end
end