DEVELOPER GUIDE

Developer Guide / API

Server export: PerformBankTransaction

This is the official export you can call from other resources to register movements in sleekbank_transactions and (optionally) move money.

Signature

-- resource: sleek-bank/server/server_open_functions.lua
exports["sleek-bank"]:PerformBankTransaction(
    realTransaction,  -- boolean: true = move balances + record; false = only record
    ibanFrom,         -- string: source IBAN or "" for system
    ibanTo,           -- string: target IBAN or "" for system
    amount,           -- number: positive integer (cents not supported)
    description       -- string|nil: up to 500 chars
)

Behavior

  • When realTransaction = true:

    • If ibanFrom belongs to an online player, funds are removed via framework APIs. If offline, the DB is updated directly.

    • Same for ibanTo: online โ†’ framework add; offline โ†’ DB update.

    • A row is inserted into sleekbank_transactions with postโ€‘amount snapshots for both sides.

  • When realTransaction = false:

    • Only inserts a transaction row (no money moved). Useful for logging external effects.

Special cases

  • For system charges/credits use an empty IBAN for one side:

    • Bank fee: ibanFrom = playerIban, ibanTo = "".

    • Interest credit: ibanFrom = "", ibanTo = playerIban.

Example: charge a player and credit a business account

local ok = exports["sleek-bank"]:PerformBankTransaction(
  true,
  "BANK123456789012",   -- player
  "BANKFLEECABUS001",   -- business
  2500,                 -- $2,500
  "Vehicle purchase"
)

Example: log a fine without moving money

exports["sleek-bank"]:PerformBankTransaction(
  false,
  "BANK123456789012",
  "",
  500,
  "Admin note: unpaid fine recorded"
)

The export does not return a value; it performs the operation (and emits framework notifications where applicable).


Public Events (Safe to Publish)

Security notice For security reasons, serverโ€‘side triggers, parameter shapes, auth tokens and antiโ€‘abuse checks are intentionally omitted from the public docs. If you need additional events or developer access, open a support ticket and weโ€™ll provide vetted guidance for your integration.

Client events (receiveโ€‘only)

These events are emitted to clients and do not grant write access. Itโ€™s safe to list them publicly.

  • sleek-bank:client:OpenBank (data) Opens the banking UI with the current account snapshot. Payload (highโ€‘level): IBAN, balance, totals, recent transactions, card status, whether the session is ATM/bank, and optional savings/loan summary.

  • sleek-bank:client:Update (data) Refreshes the UI with an updated account snapshot. Payload (highโ€‘level): same structure as above (balance/totals/transactions).

Result notifications (readโ€‘only)

The UI listens for simple result notifications where the payload is 1 (success) or 0 (failure). Listing these is safe; they do not perform actions by themselves.

  • UpdateMyIban

  • DepositMoney

  • WithdrawMoney

  • TransferMoney

  • BuyCreditCard

  • EnterPin

  • SetPin

  • RequestLoan

  • ActivateSavings

  • SavingsDeposit

  • SavingsWithdraw

  • LoanCompleted

These are notifications only. Business logic runs serverโ€‘side with validation (proximity, ownership, balances, rate limits, etc.).

Opening the UI from other scripts

For programmatic UI access (e.g., from another resource), we provide an internal, protected integration. We do not publish the serverโ€‘side entrypoint or parameters publicly. ๐Ÿ‘‰ If your resource needs to open the bank UI, open a support ticket with your use case and weโ€™ll share the appropriate, secured approach.


Database

Tables are created by sleek-bank.sql.

sleekbank_accounts

Column
Type
Notes

identifier

varchar(46) PK

ESX license / QB citizenid

iban

varchar(64) UK

Unique IBAN

balance

int unsigned

Bank balance

card_pin

varchar(16)

PIN (optional)

card_activated

tinyint(1)

0/1

sleekbank_transactions

Column
Type
Notes

id

int AI PK

iban_from

varchar(64)

May be "" (system)

iban_to

varchar(64)

May be "" (system)

amount

int unsigned

Positive amounts only

description

varchar(500)

Optional

date

datetime

Defaults to CURRENT_TIMESTAMP

iban_from_post_amount

int unsigned NULL

Balance after tx (source)

iban_to_post_amount

int unsigned NULL

Balance after tx (target)

Indexes on iban_from, iban_to, date and combined (iban_from,date) / (iban_to,date) enable fast history queries.

sleekbank_loans

Tracks loans, installments, next payment time (ms), penalties, and whether requested or approved.

sleekbank_savings

Tracks savings balance, total growth from interest, and next_interest timestamp

Last updated