Exports & events
All exports are server-side. Amounts are whole numbers above zero, up to Config.MaxAmount. For the exports of qb-banking, Renewed-Banking, esx_banking and okokBanking, see Replacing your banking script.
Society & gang money
The account is a job name ('police' or 'society_police') or a gang ('gang_ballas').
exports['hz_banking']:AddMoney(account, amount, reason) -- true / false. Creates the account if missing
exports['hz_banking']:RemoveMoney(account, amount, reason) -- false when the balance is too low
exports['hz_banking']:GetAccount(account) -- balance, 0 when unknown
exports['hz_banking']:GetAccountBalance(account) -- same
exports['hz_banking']:GetAccountInfo(account) -- { type, id, iban, name, balance } or nil
exports['hz_banking']:EnsureAccount(account, label) -- creates it if missing, returns the info
exports['hz_banking']:GetTransactions(account, limit) -- latest lines, 200 at most
exports['hz_banking']:GetVersion()
The reason (64 characters) shows in the account history.
Personal history
Personal money is your framework's bank money: move it with your framework as usual. These two exports read the history, or add a line for money moved elsewhere (a phone payment, a shop) so it shows in the bank app.
-- who: a server ID or a character ID
exports['hz_banking']:GetPersonalTransactions(who, limit) -- newest first, 200 at most
-- kind: 'deposit', 'withdraw', 'transfer_in' or 'transfer_out'. Writes a line, moves no money
exports['hz_banking']:LogPersonalTransaction(who, kind, amount, reason, counterName) -- true / false
Bills
-- receiver: a server ID or a character ID
-- issuer: 'police' / 'society_police', 'gang_ballas', or { type = 'personal', id = charId, label = 'John Doe' }
-- opts (optional): { label, author, authorName, receiverName, canDecline }
exports['hz_banking']:CreateInvoice(receiver, issuer, amount, reason, opts) -- { ok = true, id } or { ok = false, err }
exports['hz_banking']:GetInvoices(receiver, onlyOpen) -- the player's latest bills
exports['hz_banking']:GetInvoice(id)
exports['hz_banking']:PayInvoice(source, id) -- paid from the player's bank
exports['hz_banking']:CancelInvoice(id)
exports['hz_banking']:GetUnpaidTotal(receiver) -- open bills plus late fees
exports['hz_banking']:BillingEnabled() -- false when bills are off
A bill comes back as:
{
id = 12, amount = 500, fee = 0, total = 500, reason = 'Repair',
status = 'pending', -- 'pending', 'overdue', 'paid', 'declined' or 'cancelled'
issuer = { type = 'society', id = 'mechanic', label = 'Mechanic' },
author = 'John Doe', receiver = 'Jane Doe',
created = 1767225600, due = 1767830400, dueIn = 604800, closed = nil,
canDecline = true,
}
Savings & loans
charId is the character ID (citizenid or identifier).
exports['hz_banking']:GetSavingsBalance(charId) -- 0 when none
exports['hz_banking']:GetCreditScore(charId)
exports['hz_banking']:GetLoan(charId) -- { remaining, installment, status, missed } or nil
Server events
Local server events, for AddEventHandler in another server script. Players can't send them.
-- A society or gang account moved at the bank (deposit, withdrawal, transfer, scheduled transfer)
AddEventHandler('HZ-Banking:server:movement', function(m)
-- m.accountType ('society' / 'gang'), m.accountId, m.kind ('deposit', 'withdraw', 'transfer_in', 'transfer_out'),
-- m.amount, m.counterName, m.counterIban, m.reason, m.actorCharId, m.actorName
end)
-- Bills: the bill table above
AddEventHandler('HZ-Banking:server:invoiceCreated', function(bill) end)
AddEventHandler('HZ-Banking:server:invoicePaid', function(bill) end)
AddEventHandler('HZ-Banking:server:invoiceDeclined', function(bill) end)
AddEventHandler('HZ-Banking:server:invoiceCancelled', function(bill) end)
AddEventHandler('HZ-Banking:server:invoiceOverdue', function(bill) end)
-- A loan went into default (once per loan)
AddEventHandler('HZ-Banking:server:loanDefaulted', function(d)
-- d.charId, d.loanId, d.remaining
end)
HZ-Banking also listens to qb-banking:server:SetBankClosed(bankId, closed) to close a bank during a robbery, see Banks & bankers.
Client event
-- Fired when the bank app or the ATM opens (false) and closes (true), to hide your own HUD
AddEventHandler('HZ-Banking:client:hud', function(visible) end)
HZ-Hud and the game's minimap are hidden on their own.
