Kartik Scripts

DebitAccount

local ok, err = exports['kartik-banking']:DebitAccount(accountType, accountId, amount, reason)

🔹 Description

Takes money from any account: a player's personal or Swiss account, a company account or a shared account. Use it for shops, gas stations, fines, rent or job charges.

Works for offline players too, and never takes an account below zero. Fires the onWithdraw event when it succeeds.


🔧 Parameters

NameTypeRequiredDescription
accountTypestring✅'personal', 'swiss', 'company' (or 'job'), 'shared'
accountIdstring✅personal / swiss: the player's citizenid. company: the job name. shared: the account number
amountnumber✅Whole dollars, above 0
reasonstring✅Shown in the player's transaction history

📤 Returns

TypeDescription
trueThe money was taken
false, errorNothing was taken. error is one of the codes below
ErrorMeaning
invalid_amountAmount missing or not above 0
reason_requiredNo reason given
account_not_foundNo account for that type and id
account_frozenThe account is frozen
insufficient_balanceNot enough money (DebitAccount only)
account_not_activatedThe account has no debit card yet
transaction_failedThe money could not be moved

🧠 Example Usage

-- Gas station charging the player's bank card
local citizenid = exports.qbx_core:GetPlayer(source).PlayerData.citizenid
local ok, err = exports['kartik-banking']:DebitAccount('personal', citizenid, 85, 'Fuel - Route 68')
if not ok then
    lib.notify(source, { description = 'Card declined', type = 'error' })
end

On this page