> For the complete documentation index, see [llms.txt](https://docs.menanak47.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.menanak47.com/multi-framework/ak47_banking/exports/server.md).

# Server

### 🔗 How to use Exports

All functions are server-side and can be accessed using the standard FiveM export syntax:

```lua
exports['ak47_banking']:FunctionName(parameters)
```

***

### 👤 Player Banking & Transactions

These functions allow you to safely manipulate a player's personal bank account without creating "silent transactions." Using these exports ensures the transaction appears in the player's UI.

#### `AddPlayerBankMoney`

Adds money to a player's personal bank account and logs the transaction.

| **Parameter** | **Type**  | **Description**                  |
| ------------- | --------- | -------------------------------- |
| `source`      | `integer` | The server ID of the player.     |
| `amount`      | `number`  | The amount to deposit.           |
| `reason`      | `string`  | The description shown in the UI. |

Returns: `boolean` (true if successful)

```lua
-- Example: Paying a player a specific bonus
local success = exports['ak47_banking']:AddPlayerBankMoney(source, 5000, "Lottery Winnings")
```

#### `RemovePlayerBankMoney`

Removes money from a player's personal bank account (fails if they have insufficient funds).

| **Parameter** | **Type**  | **Description**                  |
| ------------- | --------- | -------------------------------- |
| `source`      | `integer` | The server ID of the player.     |
| `amount`      | `number`  | The amount to withdraw.          |
| `reason`      | `string`  | The description shown in the UI. |

Returns: `boolean`, `string` (success status, and an error message if failed)

```lua
-- Example: Charging a player for a vehicle purchase
local success, msg = exports['ak47_banking']:RemovePlayerBankMoney(source, 25000, "Vehicle Purchase: Panto")
if not success then
    print("Failed: " .. msg) -- "Insufficient funds"
end
```

#### `LogCustomTransaction`

Manually push a transaction log to a player's UI with a custom icon and color. Useful if you handle the money logic elsewhere but want it on their bank statement.

| **Parameter** | **Type** | **Description**                              |
| ------------- | -------- | -------------------------------------------- |
| `citizenid`   | `string` | The Citizen ID of the player.                |
| `title`       | `string` | Transaction description.                     |
| `amount`      | `number` | Positive for income, negative for expense.   |
| `type`        | `string` | `"deposit"`, `"withdrawal"`, or `"transfer"` |
| `icon`        | `string` | Lucide Icon name (e.g., `"Car"`, `"Home"`)   |
| `color`       | `string` | Tailwind color class (e.g., `"bg-red-500"`)  |

```lua
-- Example: Logging a house purchase with a custom house icon
exports['ak47_banking']:LogCustomTransaction("CID12345", "Purchased Property", -150000, "withdrawal", "Home", "bg-purple-500")
```

***

### 🏢 Business & Shared Accounts

Interact with Job, Gang, or custom Shared player accounts.

#### `GetAccountBalance`

Returns the current balance of any business or shared account.

| **Parameter** | **Type** | **Description**                                           |
| ------------- | -------- | --------------------------------------------------------- |
| `accountName` | `string` | The name of the account (e.g., `"police"`, `"mechanic"`). |

Returns: `number`

```lua
local mechFunds = exports['ak47_banking']:GetAccountBalance("mechanic")
print("The mechanic shop has $" .. mechFunds)
```

#### `AddMoney` / `RemoveMoney`

Adds or removes money from a business/shared account.

| **Parameter** | **Type** | **Description**             |
| ------------- | -------- | --------------------------- |
| `accountName` | `string` | The name of the account.    |
| `amount`      | `number` | The amount to transact.     |
| `reason`      | `string` | Reason for the transaction. |

Returns: `boolean`

```lua
-- Example: Charging a business for importing supplies
local success = exports['ak47_banking']:RemoveMoney("burgershot", 500, "Ingredient Restock")

-- Example: Paying a business from a state grant
local success = exports['ak47_banking']:AddMoney("police", 50000, "State Funding Grant")
```

#### `HasSharedAccountAccess`

Checks if a specific player has permission to use a shared account.

| **Parameter** | **Type** | **Description**                 |
| ------------- | -------- | ------------------------------- |
| `citizenid`   | `string` | The Citizen ID of the player.   |
| `accountName` | `string` | The name of the shared account. |

Returns: `boolean`

```lua
local hasAccess = exports['ak47_banking']:HasSharedAccountAccess(cid, "SmithFamilyFund")
```

***

### 💳 Credit & Debit Cards

#### `GetPlayerCards`

Fetches a list of all cards owned by a player.

| **Parameter** | **Type** | **Description**               |
| ------------- | -------- | ----------------------------- |
| `citizenid`   | `string` | The Citizen ID of the player. |

Returns: `table` (List of card objects)

```lua
local cards = exports['ak47_banking']:GetPlayerCards(cid)
for _, card in ipairs(cards) do
    print("Card ID: " .. card.id .. " | Balance: $" .. card.balance)
end
```

#### `ChargeCard`

Directly charges a specific card. Automatically handles whether the card is prepaid or linked directly to the main bank balance. Excellent for toll booths or vending machines.

| **Parameter** | **Type** | **Description**            |
| ------------- | -------- | -------------------------- |
| `cardId`      | `string` | The unique ID of the card. |
| `amount`      | `number` | The amount to charge.      |
| `reason`      | `string` | Transaction description.   |

Returns: `boolean`, `string`

```lua
-- Example: Highway Toll Booth
local success, msg = exports['ak47_banking']:ChargeCard("C12345678", 15, "Highway Toll")
```

***

### 📈 Credit Score & Loans

#### `GetCreditScore`

Retrieves a player's current credit score.

| **Parameter** | **Type** | **Description**               |
| ------------- | -------- | ----------------------------- |
| `citizenid`   | `string` | The Citizen ID of the player. |

Returns: `number`

```lua
local score = exports['ak47_banking']:GetCreditScore(cid)
if score >= 700 then
    print("Approved for premium financing!")
end
```

#### `UpdateCreditScore`

Modifies a player's credit score (can be positive or negative).

| **Parameter** | **Type** | **Description**               |
| ------------- | -------- | ----------------------------- |
| `citizenid`   | `string` | The Citizen ID of the player. |
| `amount`      | `number` | Amount to add/subtract.       |

Returns: `boolean`

```lua
-- Reward player for paying a custom dealership invoice on time
exports['ak47_banking']:UpdateCreditScore(cid, 5)
```

#### `GetActiveLoans`

Checks a player's debt status. Useful for preventing players from taking out car loans if they are already in massive debt.

Returns: `table` `{ count, totalDebt, loans }`

```lua
local debtInfo = exports['ak47_banking']:GetActiveLoans(cid)
print("Player has " .. debtInfo.count .. " loans totaling $" .. debtInfo.totalDebt)
```

***

### ⚖️ Law Enforcement & Taxes

#### `GetBankFlags` / `AddBankFlag` / `RemoveBankFlag`

Integrate with an external MDT to place freezes, warrants, or flags on a bank account.

```lua
-- Add a flag to an account
exports['ak47_banking']:AddBankFlag(cid, "Suspected Fraud", "Officer Smith")

-- Read flags (Returns a table of flags)
local flags = exports['ak47_banking']:GetBankFlags(cid)

-- Remove a flag
exports['ak47_banking']:RemoveBankFlag(cid, "Suspected Fraud")
```

#### `GetUnpaidTaxes`

Check if a player is evading taxes.

Returns: `table` `{ hasUnpaid, totalOwed, overdueCount, records }`

```lua
local taxData = exports['ak47_banking']:GetUnpaidTaxes(cid)
if taxData.hasUnpaid then
    print("Cannot sell property to tax evaders!")
end
```

***

### 🏛️ City Treasury (Mayor/Gov)

Interact with the central government account.

#### Functions

* `GetCityTreasuryBalance()`
* `AddCityTreasuryFunds(amount, reason)`
* `RemoveCityTreasuryFunds(amount, reason)`

```lua
-- Example: Paying for a city-wide event from the treasury
local success, msg = exports['ak47_banking']:RemoveCityTreasuryFunds(50000, "City Event Funding")
```

***

### 📊 Stock Market Manipulation

#### `ForceStockMarketEvent`

Force a specific stock to "crash" or "boom". Perfect for Heist scripts (e.g., robbing a specific company crashes their stock, or stealing data boosts a rival's stock).

| **Parameter** | **Type** | **Description**                             |
| ------------- | -------- | ------------------------------------------- |
| `symbol`      | `string` | The stock ticker (e.g., `"LSC"`, `"MAZE"`). |
| `eventType`   | `string` | `"crash"` or `"boom"`                       |

Returns: `boolean`, `string`

```lua
-- Example: Player successfully robbed Fleeca Bank
exports['ak47_banking']:ForceStockMarketEvent("FLE", "crash")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.menanak47.com/multi-framework/ak47_banking/exports/server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
