Server exports

Bank

Server exports that write to the Bank app's history and read or set bank data.

Money itself is moved through your framework. See Bank, invoices and crypto and Bank integration.

#AddTransaction

Adds a row to a character's bank history. No money moves.

lua---@param target string a character identifier or a phone number
---@param amount number negative for money going out, positive for money coming in; not 0
---@param title string
---@param icon? string a picture for the row: a file of your resource or an image link
---@return boolean added
exports['fx-phone']:AddTransaction(target, amount, title, icon)
luaexports['fx-phone']:AddTransaction(citizenid, -250, 'Parking fine')
  • The cylex_phone form addTransaction(identifier, data) is a separate export with its own arguments: see cylex_phone compatibility.

#GetBankData

Returns what the Bank app knows about a character.

Also available as: getBankData

lua---@param identifier string
---@return { balance: number|nil, iban: string, crypto: table }|nil bank
exports['fx-phone']:GetBankData(identifier)
lualocal bank = exports['fx-phone']:GetBankData(citizenid)
  • balance is nil when the character is offline. crypto is a list of { coin, amount, value }.

#SetBankData

Changes a character's IBAN, or an online player's bank balance.

Also available as: setBankData

lua---@param identifier string
---@param key 'iban'|'balance'
---@param value string|integer an IBAN, or a whole balance of 0 or more
---@return boolean ok
exports['fx-phone']:SetBankData(identifier, key, value)
luaexports['fx-phone']:SetBankData(citizenid, 'iban', 'FX12345678')
  • balance is set through the framework: the difference to the current balance is added or removed. The player must be online.
  • iban follows the rules of SetUserData: 4 to 34 letters and digits, not in use.