> For the complete documentation index, see [llms.txt](https://cactus-code.gitbook.io/cactus-code-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cactus-code.gitbook.io/cactus-code-docs/documentation/scripts/cactus-ultimate/export.md).

# Export

***

### Table of Contents

* Client Exports
* Server Exports
  * Duty Management
  * Money Management
  * Gold Management
  * History
* Quick Reference
* Important Notes

***

### Client Exports

#### Client IsPlayerOnDuty

Checks if the local player is currently on duty.

```lua
local isOnDuty = exports['cactus_bossmenu']:IsPlayerOnDuty()
```

**Returns:**

| Name     | Type    | Description                   |
| -------- | ------- | ----------------------------- |
| isOnDuty | boolean | true if the player is on duty |

***

### Server Exports

#### Server IsPlayerOnDuty

Checks if a specific player is on duty.

```lua
local isOnDuty = exports['cactus_bossmenu']:IsPlayerOnDuty(source)
```

**Parameters:**

| Name   | Type   | Description      |
| ------ | ------ | ---------------- |
| source | number | Player server ID |

**Returns:**

| Name     | Type    | Description                   |
| -------- | ------- | ----------------------------- |
| isOnDuty | boolean | true if the player is on duty |

***

#### Server SetPlayerOnDuty

Force a player's duty status.

```lua
exports['cactus_bossmenu']:SetPlayerOnDuty(source, true)  -- Set on duty
exports['cactus_bossmenu']:SetPlayerOnDuty(source, false) -- Set off duty
```

**Parameters:**

| Name   | Type    | Description                      |
| ------ | ------- | -------------------------------- |
| source | number  | Player server ID                 |
| status | boolean | true = on duty, false = off duty |

***

#### Server GetPlayerJobInfo

Get the job and grade of a player.

```lua
local job, grade = exports['cactus_bossmenu']:GetPlayerJobInfo(source)
```

**Parameters:**

| Name   | Type   | Description      |
| ------ | ------ | ---------------- |
| source | number | Player server ID |

**Returns:**

| Name  | Type   | Description       |
| ----- | ------ | ----------------- |
| job   | string | Player's job name |
| grade | number | Player's grade    |

***

#### Server GetAllPlayersOnDuty

Get a list of all players currently on duty.

```lua
local players = exports['cactus_bossmenu']:GetAllPlayersOnDuty()
```

**Returns:**

| Name    | Type  | Description                     |
| ------- | ----- | ------------------------------- |
| players | table | Array of `{source, job, grade}` |

**Example:**

```lua
local onDuty = exports['cactus_bossmenu']:GetAllPlayersOnDuty()
for _, player in ipairs(onDuty) do
    print(player.source, player.job, player.grade)
end
```

***

#### Server GetPlayersOnDutyByJob

Get all players on duty for a specific job.

```lua
local players = exports['cactus_bossmenu']:GetPlayersOnDutyByJob('police')
```

**Parameters:**

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| job  | string | Job name to filter |

**Returns:**

| Name    | Type  | Description                     |
| ------- | ----- | ------------------------------- |
| players | table | Array of `{source, job, grade}` |

***

### Business Management Exports

#### Server GetBusinessBalance

Get the money and gold balance of a company.

```lua
local money, gold = exports['cactus_bossmenu']:GetBusinessBalance('police')
```

**Parameters:**

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| job  | string | Company job name |

**Returns:**

| Name  | Type   | Description  |
| ----- | ------ | ------------ |
| money | number | Cash balance |
| gold  | number | Gold balance |

***

#### Server AddBusinessMoney

Add money to a company account.

```lua
local success = exports['cactus_bossmenu']:AddBusinessMoney('police', 1000, 'Sale revenue')
```

**Parameters:**

| Name   | Type   | Description                             |
| ------ | ------ | --------------------------------------- |
| job    | string | Company job name                        |
| amount | number | Amount to add                           |
| reason | string | *(optional)* Reason for the transaction |

**Returns:**

| Name    | Type    | Description        |
| ------- | ------- | ------------------ |
| success | boolean | true if successful |

> ℹ️ All transactions are automatically logged in the company history.

***

#### Server RemoveBusinessMoney

Remove money from a company account.

```lua
local success = exports['cactus_bossmenu']:RemoveBusinessMoney('police', 500, 'Equipment purchase')
```

**Parameters:**

| Name   | Type   | Description                             |
| ------ | ------ | --------------------------------------- |
| job    | string | Company job name                        |
| amount | number | Amount to remove                        |
| reason | string | *(optional)* Reason for the transaction |

**Returns:**

| Name    | Type    | Description                 |
| ------- | ------- | --------------------------- |
| success | boolean | false if insufficient funds |

***

#### Server SetBusinessBalance

Set the exact balance of a company.

```lua
local success = exports['cactus_bossmenu']:SetBusinessBalance('police', 5000)
```

**Parameters:**

| Name   | Type   | Description      |
| ------ | ------ | ---------------- |
| job    | string | Company job name |
| amount | number | New balance      |

**Returns:**

| Name    | Type    | Description        |
| ------- | ------- | ------------------ |
| success | boolean | true if successful |

> ⚠️ This overwrites the current balance. Use with caution.

***

#### Server TransferBusinessMoney

Transfer money between two companies.

```lua
local success = exports['cactus_bossmenu']:TransferBusinessMoney('police', 'doctor', 1000, 'Medical supplies')
```

**Parameters:**

| Name    | Type   | Description                      |
| ------- | ------ | -------------------------------- |
| fromJob | string | Source company                   |
| toJob   | string | Destination company              |
| amount  | number | Amount to transfer               |
| reason  | string | *(optional)* Reason for transfer |

**Returns:**

| Name    | Type    | Description                            |
| ------- | ------- | -------------------------------------- |
| success | boolean | false if source has insufficient funds |

***

#### Server CanBusinessAfford

Check if a company can afford a specific amount.

```lua
local canAfford = exports['cactus_bossmenu']:CanBusinessAfford('police', 1000)
```

**Parameters:**

| Name   | Type   | Description      |
| ------ | ------ | ---------------- |
| job    | string | Company job name |
| amount | number | Amount to check  |

**Returns:**

| Name      | Type    | Description               |
| --------- | ------- | ------------------------- |
| canAfford | boolean | true if balance >= amount |

***

### Gold Management Exports

#### Server AddBusinessGold

Add gold to a company account.

```lua
local success = exports['cactus_bossmenu']:AddBusinessGold('police', 10, 'Gold deposit')
```

**Parameters:**

| Name   | Type   | Description                             |
| ------ | ------ | --------------------------------------- |
| job    | string | Company job name                        |
| amount | number | Gold amount to add                      |
| reason | string | *(optional)* Reason for the transaction |

**Returns:**

| Name    | Type    | Description        |
| ------- | ------- | ------------------ |
| success | boolean | true if successful |

***

#### Server RemoveBusinessGold

Remove gold from a company account.

```lua
local success = exports['cactus_bossmenu']:RemoveBusinessGold('police', 5, 'Gold withdrawal')
```

**Parameters:**

| Name   | Type   | Description                             |
| ------ | ------ | --------------------------------------- |
| job    | string | Company job name                        |
| amount | number | Gold amount to remove                   |
| reason | string | *(optional)* Reason for the transaction |

**Returns:**

| Name    | Type    | Description                |
| ------- | ------- | -------------------------- |
| success | boolean | false if insufficient gold |

***

### History Exports

#### Server GetBusinessHistory

Get the transaction history of a company.

```lua
local history = exports['cactus_bossmenu']:GetBusinessHistory('police', 50)
```

**Parameters:**

| Name  | Type   | Description                            |
| ----- | ------ | -------------------------------------- |
| job   | string | Company job name                       |
| limit | number | *(optional)* Max entries (default: 50) |

**Returns:**

| Name    | Type  | Description                  |
| ------- | ----- | ---------------------------- |
| history | table | Array of transaction records |

**Transaction record structure:**

```lua
{
    type = "deposit",           -- deposit, withdraw, deposit_gold, withdraw_gold, salary, bonus
    amount = 100.00,
    playerName = "John Doe",
    date = "10-12-2024 14:30:00"
}
```

***

> ✅ **Synchronous Returns**: All banking exports are synchronous and return results immediately—no callbacks needed.


---

# 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://cactus-code.gitbook.io/cactus-code-docs/documentation/scripts/cactus-ultimate/export.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.
