Skip to main content

BenzyMoney — Integrations

Step-by-step, copy-paste guides for wiring BenzyMoney into other resources (HUDs, phones, shops, and more). Each entry says exactly what to paste and where, so setting it up — or re-doing it after a script update — is quick. More integrations get added here over time.

Standalone setup. These guides assume BenzyMoney is your money system on a standalone server (no ESX/QBCore). In your server.cfg, always ensure BenzyMoney before the resource you're integrating.

Contents

What integrations use

Most client-side integrations only need two things from BenzyMoney (the full API is in EXPORTS.md and EVENTS.md):

  • Read your own balancesexports.BenzyMoney:GetMyCash(), :GetMyBank(), :GetMyMoney() (→ { cash, bank, total }). Cheap local reads, always current.
  • Live updates — the client event BenzyMoney:UpdateBalance ({ cash, bank, total }) fires the instant either balance changes (and on load). Trigger BenzyMoney:RequestBalance to ask BenzyMoney to push your current balances right now.

JG HUD

Tells jg-hud to read cash + bank from BenzyMoney and keep them updated live.

jg-hud's Framework.* code is its own internal naming for "where to read data from" — it is not ESX/QBCore, and pointing it at BenzyMoney does not install a framework. You stay fully standalone.

1 — Set the framework (jg-hud config/config.lua)

Config.Framework = "Benzy"

BenzyMoney is money-only, so also turn off the components it can't provide:

Config.ShowComponents.job = false
Config.ShowComponents.gang = false
Config.ShowComponents.dirtyMoneyBalance = false

2 — Add the balance reader (jg-hud framework/cl-functions.lua)

Find function Framework.Client.GetBalance(type). Add this branch to its if / elseif chain — right after the ESX block:

elseif Config.Framework == "Benzy" then
if type == "bank" then return exports.BenzyMoney:GetMyBank() or 0 end
if type == "cash" or type == "money" then return exports.BenzyMoney:GetMyCash() or 0 end
return 0 -- BenzyMoney has no dirty / black money
end

3 — Add the live listener (jg-hud framework/cl-functions.lua)

Find function Framework.Client.CreateEventListeners(). Paste this block inside it (anywhere among the other if Config.Framework == ... blocks — e.g. just before the function's final end):

if Config.Framework == "Benzy" then
RegisterNetEvent("BenzyMoney:UpdateBalance", function(data)
Framework.CachedPlayerData.cash = data.cash
Framework.CachedPlayerData.bank = data.bank
end)
TriggerServerEvent("BenzyMoney:RequestBalance") -- pull the current values right now
end

Done

Restart jg-hud. Cash + bank now come from BenzyMoney and update the instant a balance changes. Login works automatically — any non-QB/ESX framework value (like "Benzy") uses jg-hud's built-in standalone login path.


GKSPHONE

Makes GKSPhone use BenzyMoney as its money backend, so the phone and the /money menu share the same balances. Covers your bank balance, player-to-player bank transfers (online or offline), and every in-app purchase the phone charges for (SIM plans, data packages, ads, valet, Twitter Blue, …) — they all run through the same bank functions.

Scope. Every operation that spends or receives player money is covered — balance, transfers, and all in-app purchases — because they all run through the bank functions you wire below. Not covered: the phone is bank-only, so no cash, deposit/withdraw, or money requests (those stay in the /money menu and at ATMs); and the job-based tip/billing apps use the Society* stubs and aren't wired here. The SIM data allowance (MB) is GKSPhone's own internal resource, not money. Because every phone money move flows through BenzyMoney, the /money menu (and the GetTransactions export) is the complete history; the phone's own history tab still shows only what the phone itself did.

1 — Set the framework (gksphone config/config.lua)

Config.Framework = "standalone"

2 — Wire the bank money functions (gksphone server/framework/standalone.lua)

Replace the four stub functions (GetBankBalance, GetBankBalanceByIndetifier, RemoveBankMoney, AddBankMoney — they currently just return 0 / return true) with:

function GetBankBalance(source)
return exports.BenzyMoney:GetBank(source) or 0
end

function GetBankBalanceByIndetifier(identifier)
return exports.BenzyMoney:GetBank(identifier) or 0
end

function RemoveBankMoney(source, amount)
return exports.BenzyMoney:RemoveBank(source, amount, "Phone transfer") and true or false
end

function AddBankMoney(source, amount)
return exports.BenzyMoney:AddBank(source, amount, "Phone transfer") and true or false
end

BenzyMoney resolves both a server id and a license:… string, and works offline — so the online and by-identifier transfer paths both work with no extra handling.

3 — Wire offline transfers (gksphone server/framework/standalone.lua)

In the same file, replace the whole GetOfflinePlayerByIdentifier function. This covers GKSPhone's offline transfer modes — paying an offline recipient (Config.OfflineBankTransfer), and charging a phone's offline owner (Config.MetaBankTransfer, where the money comes from the phone's registered owner rather than whoever's holding it) — so those move BenzyMoney money too:

function GetOfflinePlayerByIdentifier(identifier)
local self = {}
function self.getAccount(account)
local bal = exports.BenzyMoney:GetBalances(identifier)
if bal then return { money = (account == "cash") and bal.cash or bal.bank } end
return nil
end
function self.removeAccountMoney(account, amount, reason)
return exports.BenzyMoney:RemoveMoney(identifier, account == "cash" and "cash" or "bank", amount, reason or "Phone transfer") and true or false
end
function self.addAccountMoney(account, amount, reason)
return exports.BenzyMoney:AddMoney(identifier, account == "cash" and "cash" or "bank", amount, reason or "Phone transfer") and true or false
end
function self.getName()
local d = exports.BenzyMoney:GetPlayerData(identifier)
return d and d.name or ""
end
return self
end

4 — Wire the client balance (gksphone client/framework/standalone.lua)

Replace GetPlayerBankBalance with:

function GetPlayerBankBalance()
return exports.BenzyMoney:GetMyBank() or 0
end

Done

ensure BenzyMoney before gksphone in your server.cfg, then restart. The phone bank app now shows your BenzyMoney bank, and its transfers move BenzyMoney money — fully in sync with the /money menu.

Notes

  • GKSPhone identifies players by license:…, which is exactly what BenzyMoney keys on — no mapping needed.
  • GKSPhone's transfer tax (Config.BankTransferTax) is taken from the sender and removed from circulation (its normal behavior); set it to 0 for no fee.
  • The Society* / job functions are left as stubs — see the scope note for tip/billing.

Prompt Studio Train Script

Charges the train script's ticket fares through BenzyMoney, so they leave the same cash/bank balance the /money menu shows.

Route the fare through BenzyMoney (train script config/server.lua)

Paste at the bottom of the file. Bridge is global there and config is already local to it, so this redefines the one function the script set up above — re-pasting it is all a script update needs:

-- BenzyMoney -- take the fare from the player's configured account.
function Bridge.removePayment(source, amount)
return exports.BenzyMoney:RemoveMoney(source, config.paymentMethod, amount, 'Train ticket') and true or false
end

Done

ensure BenzyMoney before the train script in your server.cfg, then restart. Buying a ticket now debits BenzyMoney, and every fare lands in the /money history and your Discord log.

Optional — keep the fare instead of destroying it. By default the fare just leaves the player. To bank it somewhere instead, use this removePayment — the account key is either 'government' for the government/society account, or a business key from Config.Businesses:

function Bridge.removePayment(source, amount)
if not exports.BenzyMoney:RemoveMoney(source, config.paymentMethod, amount, 'Train ticket') then return false end
exports.BenzyMoney:AddToAccount('government', amount, 'Train fare') -- or a business key from Config.Businesses
return true
end

Notes

  • A player who can't afford the fare is refused the ticket (RemoveMoney returns false), so it is never handed over free.
  • paymentMethod (train script config/config.lua) picks which balance a fare comes out of. Leave it at 'cash' or 'bank' — both map straight onto BenzyMoney's accounts, so no mapping is needed.
  • Fares stay the train script's own numbers (tickets.defaultPrice, plus per-station tickets.prices), and framework / inventory stay as they are — BenzyMoney only moves the amount.