Exports

Overview

The omes_banking script provides a comprehensive set of exports that allow other resources to interact with the banking system. These exports are split into client-side and server-side functions.


Client-Side Exports

These exports can be called from any client-side script.

openBank

Opens the full bank UI menu with all features (overview, transfers, savings, loans, etc.).

exports['omes_banking']:openBank()

Example:

-- Open bank from a custom NPC or location
RegisterCommand('bank', function()
    exports['omes_banking']:openBank()
end)

openATM

Opens the simplified ATM UI (deposit, withdraw, and recent transactions only).

Example:


isBankOpen

Returns whether the bank UI is currently open. Useful for preventing duplicate opens or checking UI state.

Returns: boolean - true if the bank UI is open, false otherwise.

Example:


closeBank

Closes the bank/ATM UI if it's currently open.

Example:


openLoanManager

Opens the Loan Manager UI. This is intended for bank employees and requires the configured banker job access.

Example:

Note: The player must have the required banker job configured in Config.BankerJobs to access this UI.


Server-Side Exports

These exports can be called from any server-side script.

getPlayerBalance

Gets a player's current bank balance.

Parameters:

Parameter
Type
Description

source

number

The player's server ID

Returns: number - The player's bank balance, or 0 if the player was not found.

Example:


addMoney

Adds money to a player's bank account. Optionally logs the transaction with a description.

Parameters:

Parameter
Type
Description

source

number

The player's server ID

amount

number

The amount to add

description

string (optional)

Transaction description for bank logs

Returns: boolean - true if successful, false if the player was not found or the amount was invalid.

Example:


removeMoney

Removes money from a player's bank account. Returns false if the player has insufficient funds.

Parameters:

Parameter
Type
Description

source

number

The player's server ID

amount

number

The amount to remove

description

string (optional)

Transaction description for bank logs

Returns: boolean - true if successful, false if the player was not found, amount was invalid, or insufficient funds.

Example:


getSavingsAccounts

Gets all savings accounts for a player by their identifier.

Parameters:

Parameter
Type
Description

identifier

string

The player's identifier (e.g., license:xxxxx or citizenid)

Returns: table - An array of savings account objects.

Account Object Structure:

Example:


getPlayerIdentifier

Gets a player's identifier from their server source ID.

Parameters:

Parameter
Type
Description

source

number

The player's server ID

Returns: string|nil - The player's identifier, or nil if the player was not found.

Example:


transferMoney

Transfers money between two players' bank accounts. Both sender and recipient must be online.

Parameters:

Parameter
Type
Description

fromSource

number

The sender's server ID

toSource

number

The recipient's server ID

amount

number

The amount to transfer

reason

string (optional)

Reason for the transfer (logged in transaction history)

Returns:

  • boolean - true if successful, false otherwise

  • string - A message describing the result

Possible Messages:

  • 'Sender not found'

  • 'Recipient not found'

  • 'Invalid amount'

  • 'Insufficient funds'

  • 'Transfer successful'

Example:


Complete Example

Here's a complete example of a script that uses multiple exports:


Notes

  • All monetary amounts are automatically rounded down to whole numbers (math.floor)

  • Transaction descriptions are optional but recommended for proper bank statement history

  • The removeMoney export will not remove money if the player has insufficient funds

  • Server exports require the player to be online (connected to the server)

  • Client exports will only work on the client that calls them

Last updated