Skip to main content

BenzyMoney — Events

Events you can listen to (react to money changes) and events you can trigger (a convenient alternative to the exports), each with a ready-to-paste example. All server events are plain TriggerEvent (server-side only) — clients can never reach the money-moving ones. In the examples, replace placeholder helpers like updateMyHud(...) with your own.


Events BenzyMoney fires (listen with AddEventHandler)

BenzyMoney:Ready (server)

Fired once when storage + accounts are loaded and the script is fully online.

AddEventHandler('BenzyMoney:Ready', function()
print('BenzyMoney is ready')
end)

BenzyMoney:PlayerLoaded (server)

A player’s money was loaded (or created on a first-ever join).

AddEventHandler('BenzyMoney:PlayerLoaded', function(data)
-- data = { src, license, id, name, cash, bank, accountNumber, isNew }
if data.isNew then
print(('%s joined for the first time with $%d'):format(data.name, data.cash + data.bank))
end
end)

BenzyMoney:PlayerSaved (server)

A player’s money was saved as they disconnected.

AddEventHandler('BenzyMoney:PlayerSaved', function(data)
-- data = { src, license, id, cash, bank }
print(('Saved %s -- cash %d, bank %d'):format(data.license, data.cash, data.bank))
end)

BenzyMoney:BalanceChanged (server)

Fired every time a player’s cash or bank changes — perfect for keeping a HUD backend, phone, or analytics in sync.

AddEventHandler('BenzyMoney:BalanceChanged', function(data)
-- data = { license, id, src, account, change, before, after, cash, bank, reason, category }
if data.src then -- src, cash, and bank are nil if the player is offline (use before/after + account for the changed field)
print(('player %s %s %d %s (now %d)'):format(
data.src, data.change >= 0 and 'gained' or 'lost',
math.abs(data.change), data.account, data.after))
end
end)

BenzyMoney:AccountBalanceChanged (server)

Fired when the government or a business account changes.

AddEventHandler('BenzyMoney:AccountBalanceChanged', function(data)
-- data = { accountType, accountKey, before, after, bank, change, reason }
print(('%s account "%s" is now %d'):format(data.accountType, data.accountKey, data.bank))
end)

BenzyMoney:DepositMade (server)

A player deposited cash into their bank (the menu, an ATM, or the DepositCash export).

AddEventHandler('BenzyMoney:DepositMade', function(data)
-- data = { license, id, src, amount } -- src is nil if it was an offline export call
end)

BenzyMoney:WithdrawMade (server)

A player withdrew from their bank into cash (the menu, an ATM, or the WithdrawCash export).

AddEventHandler('BenzyMoney:WithdrawMade', function(data)
-- data = { license, id, src, amount }
end)

BenzyMoney:TransactionLogged (server)

Fired for every transaction record written — player money moves and loan events — so you can keep an external ledger or analytics. Fires regardless of Config.LogTransactionsToDatabase.

AddEventHandler('BenzyMoney:TransactionLogged', function(tx)
-- tx = { tx_type, account_type, account_key, field, amount, balance_before, balance_after,
-- counterparty_type, counterparty_key, actor_license, actor_name, reason }
print(tx.tx_type, tx.account_type, tx.account_key, tx.amount)
end)

BenzyMoney:RequestReceived (server)

Fired when a money request is created — useful for analytics or a server-side phone backend.

AddEventHandler('BenzyMoney:RequestReceived', function(data)
-- data = { id, fromType, fromKey, fromName, toType, toKey, toName, amount, reason }
print(('%s requested %d from %s'):format(data.fromName, data.amount, data.toName))
end)

BenzyMoney:CashRobbed (server)

Fired when cash is taken via the RobCash export — for logging or reacting (dispatch alerts, etc.).

AddEventHandler('BenzyMoney:CashRobbed', function(data)
-- data = { victim, amount, robber } -- victim = license; robber = whatever you passed (or nil)
print(('%s was robbed of %d'):format(data.victim, data.amount))
end)

BenzyMoney:LoanIssued (server)

A loan was disbursed to a player (auto‑borrow, an accepted offer, or the IssueLoan export).

AddEventHandler('BenzyMoney:LoanIssued', function(data)
-- data = { loanId, license, name, amount, rateBp, interestMode, mode }
print(('%s took a %d loan (#%d)'):format(data.name, data.amount, data.loanId))
end)

BenzyMoney:LoanRepaid (server)

A payment was made toward a loan (a manual payment, a pay‑off, or RepayLoan).

AddEventHandler('BenzyMoney:LoanRepaid', function(data)
-- data = { loanId, license, amount, outstanding, paidOff }
if data.paidOff then print(('Loan #%d is paid off'):format(data.loanId)) end
end)

BenzyMoney:LoanInterestCharged (server)

Interest accrued onto a loan at the end of a payment cycle (a non‑cash event).

AddEventHandler('BenzyMoney:LoanInterestCharged', function(data)
-- data = { loanId, license, interest, outstanding }
end)

BenzyMoney:LoanDelinquent (server)

A borrower missed the minimum payment for a cycle.

AddEventHandler('BenzyMoney:LoanDelinquent', function(data)
-- data = { loanId, license, delinquencyCount, missedAmount }
end)

BenzyMoney:LoanForceCollected (server)

A manager (or the ForceCollectLoan export) pulled money from a delinquent borrower's bank.

AddEventHandler('BenzyMoney:LoanForceCollected', function(data)
-- data = { loanId, license, amount, by } -- by = manager name (nil for a system collect)
end)

BenzyMoney:LoanOffered (server)

A manager made an offer on a pending loan request (manual mode).

AddEventHandler('BenzyMoney:LoanOffered', function(data)
-- data = { loanId, license, rateBp, amount, by }
end)

BenzyMoney:LoanStatusChanged (server)

A loan moved between states (e.g. activedelinquent, offeredactive, → paid).

AddEventHandler('BenzyMoney:LoanStatusChanged', function(data)
-- data = { loanId, license, status, prevStatus }
print(('loan #%d: %s -> %s'):format(data.loanId, data.prevStatus, data.status))
end)

BenzyMoney:NotificationPushed (server)

A notification was added to a player's notifications center (by BenzyMoney or the PushNotification export).

AddEventHandler('BenzyMoney:NotificationPushed', function(data)
-- data = { license, id, kind, title, body }
end)

Events BenzyMoney sends to the client

BenzyMoney:UpdateBalance (client)

Sent to a player whenever their own balances change (and on load). Use it to drive a HUD or phone UI.

RegisterNetEvent('BenzyMoney:UpdateBalance', function(data)
-- data = { cash, bank, total }
updateMyHud(data.cash, data.bank) -- your own HUD function
end)

BenzyMoney:IncomingRequest (client)

Sent to a player who is asked to pay a money request (when it’s created, and on login for requests that queued while they were offline). Lets a phone app show its own request popup.

RegisterNetEvent('BenzyMoney:IncomingRequest', function(req)
-- req = { id, fromName, amount, amountText, reason, expiresAt, remaining, payFrom, message }
showPhoneRequest(req.fromName, req.amountText, req.id) -- your own UI
end)

BenzyMoney:RequestResolved (client)

Sent to everyone involved when a request is accepted, denied, cancelled, or expired — so a phone/UI can drop it from its list.

RegisterNetEvent('BenzyMoney:RequestResolved', function(data)
-- data = { id, status } -- status = 'accepted' | 'denied' | 'cancelled' | 'expired'
removePhoneRequest(data.id) -- your own UI
end)

Events you can trigger (server → server)

A convenience alternative to the exports for resources that prefer events. These are not net events, so a client cannot reach them. They don’t return a value — use the exports if you need to know whether it succeeded.

BenzyMoney:AddMoney(identifier, account, amount, reason) — add 'cash' or 'bank' to a player.

TriggerEvent('BenzyMoney:AddMoney', source, 'cash', 100, 'Tutorial reward')

BenzyMoney:RemoveMoney(identifier, account, amount, reason) — take 'cash' or 'bank' from a player.

TriggerEvent('BenzyMoney:RemoveMoney', source, 'bank', 50, 'Toll')

BenzyMoney:AddAccountMoney(accountKey, amount, reason) — add to the government or a business.

TriggerEvent('BenzyMoney:AddAccountMoney', 'lsac', 5000, 'Insurance payout')

BenzyMoney:RemoveAccountMoney(accountKey, amount, reason) — take from the government or a business.

TriggerEvent('BenzyMoney:RemoveAccountMoney', 'government', 1000, 'Grant')

If you need to know whether it succeeded (e.g. taking money that might not be there), prefer the exports — they return ok, newBalance|errorCode. See EXPORTS.md.