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

# Economy Monitor

{% hint style="info" %}
Information

This documentation covers **stoned-economyControl** (Economy Monitor). Keep it updated when you change config options or permissions.
{% endhint %}

{% embed url="<https://youtu.be/REPLACE_WITH_YOUR_PREVIEW>" %}
Video Preview - in-game
{% endembed %}

***

### INSTALLATION

#### 1. Resource Download

To get started, download the resource you purchased from the shop. Log in to your account on the **Cfx.re Portal**, open **Asset Grants**, and download the full package.

{% hint style="info" %}
Updates are delivered from the same Portal (Asset Grants).
{% endhint %}

#### 2. Dependencies

{% hint style="warning" %}
Make sure these resources are started **before** `stoned-economyControl`.
{% endhint %}

| Name                            | Required    | Notes                                |
| ------------------------------- | ----------- | ------------------------------------ |
| oxmysql                         | Yes         | Database                             |
| ox\_lib                         | Yes         | Shared helpers                       |
| Framework (ESX / QBCore / Qbox) | Yes         | Or leave `Config.Framework = 'auto'` |
| inventory                       | Recommended | Improves shop / stash correlation    |

#### 3. Unzip The Folder

Unzip the package, then copy the `stoned-economyControl` folder into your server resources (for example `resources/[standalone]/stoned-economyControl`).

#### 4. Ensure the resource

Add these lines to your `server.cfg` (or txAdmin recipe).

{% hint style="warning" %}
Place this **under** your essentials (framework, oxmysql, inventory).
{% endhint %}

#### 5. Permissions

Grant staff access to open the dashboard.

**ACE**&#x20;

{% code title="server.cfg" overflow="wrap" %}

```
add_ace group.admin stoned.economy.admin allow
```

{% endcode %}

**You can also allow ESX groups / QBCore permissions** in `config/config.lua` → `Config.Permission`.

#### 6. Discord (optional)

Open `config/discord.lua` (server-only file):

* `BotToken` — Discord bot token for player avatars
* `Webhook` — optional webhook for alert notifications

#### 7. Start and test

1. Restart the server (or `ensure stoned-economyControl`).
2. In-game, run `/economy` (default command — change in `config/config.lua`).
3. Open **Overview**, then generate some money activity (shop, job, vehicle purchase) and check **Timeline**.

{% hint style="info" %}
Database tables are created automatically on first start. You do not need to import SQL manually.
{% endhint %}

***

### CONFIGURATION

There are several editable config files (Asset Escrow ignore):

| File                        | Purpose                           |
| --------------------------- | --------------------------------- |
| `config/config.lua`         | Main settings                     |
| `config/discord.lua`        | Bot token + webhook               |
| `config/alerts.lua`         | Default alert rules               |
| `config/context.lua`        | Correlation windows + KnownEvents |
| `config/classification.lua` | Semantic titles / categories      |
| `config/categories.lua`     | Heuristic category rules          |
| `locales/*.lua`             | Locales                           |
| `config/wealth.lua`         | Storage / housing discovery       |

See the child pages for full previews of each file.

***

### FEATURES (overview)

* Live **Economy Health**, wealth distribution and money flow
* Global **Timeline** of classified transactions
* **Players** search + economic profile
* **Statistics**: richest lists, sources/sinks, top activities & resources
* **Alerts** with configurable thresholds
* Works on **ESX**, **QBCore** and **Qbox** without editing other scripts
* Optional `TrackTransaction` export for edge cases

***

### COMMON ISSUES

| Symptom                             | Likely cause                            | Fix                                                                                     |
| ----------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------- |
| Command does nothing                | Missing ACE / admin group               | Add `add_ace group.admin stoned.economy.admin allow`                                    |
| Timeline empty                      | No money hooks yet / wrong ensure order | Ensure framework starts first; make a test purchase                                     |
| Resource shows as empty on Timeline | Callback/net event not correlated       | Add event to `config/context.lua` → `KnownEvents`, or wait for auto ESX callback bridge |
| Discord avatars missing             | Empty `BotToken`                        | Set token in `config/discord.lua`                                                       |
| SQL errors on start                 | oxmysql not ready                       | Start `oxmysql` before this resource                                                    |

***

### SUPPORT

* Discord: [Stoned Discord](https://discord.com/invite/pS8b9SEvBr)
* Website: [Stoned Website](https://stoned-scripts.tebex.io/)
