AI Core

Banking

Open a banking script's screen and read a job's society balance through whichever banking script the server runs.

The banking layer reaches the active banking script: the one the panel's Banking script setting picks, or the first one running. It opens that script's screen and reports society balances. Job and gang money itself always moves through ai-core's money exports (Money and accounts), never through a banking script.

How job and gang accounts relate to the banking script depends on the panel setting Job and gang accounts:

  • ai-core's accounts (the default): ai-core keeps the money; the banking script shows the same balance, and money moved on its screen is moved in ai-core too.
  • The script's own accounts: the banking script keeps the money; ai-core's job and gang bank accounts read and change the script's accounts.

GetBankingSystem

The resource name of the banking script ai-core uses.

Side: Server · Waits: no · Lib: banking.provider()

Signature
GetBankingSystem(): string | null
Lua
local system = exports['ai-core']:GetBankingSystem() -- string or nil

Parameters

None.

Returns

string | null: the banking script's resource name. null when none runs (job money then stays in ai-core only).

Example

import { addCommand, resourceExport } from "@aicore-fivem/lib/server";

const core = resourceExport("ai-core");

addCommand("bankingsystem", { help: "Shows the banking script in use", restricted: true }, () => {
  console.log(core.GetBankingSystem() ?? "none");
});

OpenBank

Opens the banking script's screen for a player. Use it from your own ATM or bank counter.

Side: Server · Waits: no · Lib: banking.open

Signature
OpenBank(source: number): boolean
Lua
local opened = exports['ai-core']:OpenBank(source)

Parameters

Prop

Type

Returns

boolean: true when the screen opened. false when the player has no loaded character, no banking script runs, or its screen cannot be opened from another script.

Example

import { onClientCallback, resourceExport, near } from "@aicore-fivem/lib/server";
import { fail } from "@aicore-fivem/lib/shared";

const core = resourceExport("ai-core");
const COUNTER = { x: 149.9, y: -1040.5, z: 29.4 };

onClientCallback("myscript:bankCounter", { guards: [near(COUNTER, 2)] }, (source) =>
  core.OpenBank(source) ? { ok: true } : fail("BANK_UNAVAILABLE"),
);

GetBankSocietyBalance

A job's society balance as the banking setup shows it: ai-core's job bank account with ai-core's accounts, the script's own account with The script's own accounts. Use it for display (a boss menu); to move job money use the money exports.

Side: Server · Waits: no · Lib: banking.societyBalance

Signature
GetBankSocietyBalance(job: string): number | null
Lua
local balance = exports['ai-core']:GetBankSocietyBalance('police') -- number or nil

Parameters

Prop

Type

Returns

number | null: the balance. null when no banking script runs, the job has no account (unknown job, or the script keeps none for it), or job is not a text. Without a banking script read the job account with GetSharedMoney("job", job, "bank").

Example

import { resourceExport } from "@aicore-fivem/lib/server";

const core = resourceExport("ai-core");

/** The boss menu balance, with or without a banking script. */
export function societyBalance(job: string): number {
  return core.GetBankSocietyBalance(job) ?? core.GetSharedMoney("job", job, "bank") ?? 0;
}

On this page