Esc to clear, Enter to open the best match, click an export to open it in its page
Money
Bank Accounts
Every character has a personal bank account and can hold savings, shared and business accounts. The exports are on Bank API, and running banks in game on Banks.
Accounts and roles
An account's type is 'personal', 'savings', 'business' or 'shared'. A new character gets a personal account with Config.StartingBalance ($1000) and isDefault = 1. Account numbers are WB- and six random digits.
view (1) < deposit (2) < withdraw (3) < manager (4) < owner (5)Each role includes those before it. A granter can only give roles below their own, and owner access can't be revoked.
Moving money
| Who decides | Exports | |
|---|---|---|
| A player | Their role: deposit to pay in, withdraw to take out or transfer | BankDeposit, BankWithdraw, BankTransfer, passing the player's source or { charId = n } (a bare number is a server id, never a charId). Bank money only: no cash moves |
| The system | Your resource: no permission check | BankSystemDeposit (wages, takings), BankSystemWithdraw (fines, fees), BankSystemTransfer (payroll), logged with your resource's name |
Ask CanUseBankAccount to decide what to offer, such as only the accounts a person can pay from. To charge a player, use ChargePlayer; to pay one, PayPlayer.
-- A fine out of a player's default account
local account = exports.whip_core:GetDefaultBankAccount(source)
if account then
local ok, why = exports.whip_core:BankSystemWithdraw(account.accountId, 250, { reason = 'Speeding fine' })
endGood to know
- Whole amounts only. A fraction, zero, a string or NaN is refused with
'Amount must be a whole number of 1 or more', never rounded. - Refused outright: anything on a frozen account, and a transfer to the same account.
- No money between a player's own characters. With
Config.BlockOwnCharacterTransferson (the default), "That is another character of the same player: money cannot pass between them": no transfers, payments, withdrawals or shared accounts. It covers every way in (BankTransfer,BankDeposit,BankWithdraw,ChargePlayer,GrantBankAccess, ATMs, the phone) exceptBankSystem*moves. - Every transaction fires
whip_core:bank:balanceChanged. - Reads wait for the database. Read when the player asks (opening an app, pressing an ATM), not every frame or on a timer. To show a balance, use
GetBalance, which reads memory after its first call, or followwhip_core:bank:balanceChanged.