Exports & Events
Alle Exports sind serverseitig. Beträge sind ganze Zahlen über null, bis Config.MaxAmount. Für die Exports von qb-banking, Renewed-Banking, esx_banking und okokBanking siehe Ihr Bank-Script ersetzen.
Firmen- & Ganggeld
Das Konto ist ein Jobname ('police' oder 'society_police') oder eine 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()
Der Verwendungszweck (64 Zeichen) erscheint im Verlauf des Kontos.
Persönlicher Verlauf
Persönliches Geld ist das Bankgeld Ihres Frameworks: Bewegen Sie es wie gewohnt über Ihr Framework. Diese beiden Exports lesen den Verlauf oder fügen eine Zeile für anderswo bewegtes Geld hinzu (eine Handyzahlung, ein Shop), damit sie in der Bank-App erscheint.
-- 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
Rechnungen
-- 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
Eine Rechnung kommt so zurück:
{
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,
}
Sparkonto & Kredite
charId ist die Charakter-ID (citizenid oder 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
Lokale Server-Events, für AddEventHandler in einem anderen Server-Script. Spieler können sie nicht senden.
-- 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 hört außerdem auf qb-banking:server:SetBankClosed(bankId, closed), um eine Bank während eines Überfalls zu schließen, siehe Banken & Bankberater.
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 und die Minimap des Spiels werden von selbst ausgeblendet.
