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

# 🪙 RT COINS

Premium coins economy, shop & tablet for QBX and QB-Core. Works standalone or as an addon for `rt-pausemenu`.

> ESX is not supported. Future support is not guaranteed.

***

### 📋 Requirements

* FXServer build 17000+
* MySQL + `oxmysql`
* `ox_lib`
* `qbx_core` or `qb-core`
* Optional: `ox_target` (NPC/display-vehicle interaction), `rt-pausemenu` (open from the pause menu), `rt-vehiclekeys` or `tgiann-hotwire` (auto-detected to hand over vehicle keys on purchase / test drive).

***

### 📦 Installation

Step 1 — Upload

```
resources/[standalone]/rt-coins
```

Step 2 — Minimum config

Edit `config/config.lua`:

```lua
Config.Locale    = 'en',          -- en, es, fr, de, pt-BR, it
Config.Framework = 'auto',        -- auto | qbx_core | qb-core

-- How players open the tablet when running standalone (no pause menu):
Config.Keybinds = {
    command = 'coins',            -- chat command (false = none)
    key     = false,              -- default key e.g. 'F7' (false = none, rebindable)
}
```

QB-Core only — if the framework is not detected, force it:

```lua
Config.Framework = 'qb-core'
```

Step 3 — server.cfg

QBX example:

```cfg
ensure ox_lib
ensure oxmysql
ensure qbx_core
ensure ox_target
ensure rt-coins
```

QB-Core example:

```cfg
ensure ox_lib
ensure oxmysql
ensure qb-core
ensure ox_target
ensure rt-coins
```

> If you also run `rt-pausemenu`, start **rt-coins before rt-pausemenu**.

Step 4 — Restart

**Tables `rt_coins`, `rt_coins_log`, `rt_coins_logs`, `rt_coins_daily_missions`, `rt_coins_purchases`, `rt_coins_gifts`, `rt_coins_codes`, `rt_coins_code_redemptions`, `rt_coins_dealerships` and `rt_coins_dealer_vehicles` are created automatically. No manual SQL required (a `sql/install.sql` is included if you prefer to import them by hand).**

***

### ✅ Quick check

1. Join the server with a loaded character.
2. On foot, run `/coins` (or open it from rt-pausemenu).
3. The tablet opens with a hand prop + side camera and your coins balance shows in the header. Tablet won't open? You're in a vehicle (on foot only), or a dependency loads after rt-coins — fix the load order. UI changes not showing? Clear the NUI cache: `%localappdata%\FiveM\FiveM.app\data\cache\files\rt-coins`.

***

### 🎮 Opening the tablet

rt-coins works **two** ways — pick one:

**A) Standalone (no pause menu)** — define a command and/or key in `Config.Keybinds`:

```lua
Config.Keybinds = {
    command = 'coins',   -- chat command (false = none)
    key     = false,     -- e.g. 'F7' (false = none; player can rebind)
}
```

**B) With rt-pausemenu** — leave `command`/`key` as `false` and enable the integration in **rt-pausemenu**'s config:

```lua
-- rt-pausemenu/config/config.lua
Config.Integrations = {
    coins = { enabled = true, resource = 'rt-coins' },
}
```

The **Open RT Coins** button (profile) and the coins icon (dock) then appear in the pause menu.

> Any resource can open it too: `exports['rt-coins']:OpenTablet('shop')`.

***

### ⚙️ Main settings

File: `config/config.lua`

| Setting                                               | What it does                                        |
| ----------------------------------------------------- | --------------------------------------------------- |
| `Config.Locale`                                       | UI language (`en`, `es`, `fr`, `de`, `pt-BR`, `it`) |
| `Config.Framework`                                    | `auto` (default), `qbx_core` or `qb-core`           |
| `Config.Keybinds`                                     | Standalone open command / key                       |
| `Config.Server`                                       | Brand name shown on the tablet                      |
| `Config.Theme`                                        | Gold/silver colors (any CSS value)                  |
| `Config.Tablet` / `Config.TabletAnim`                 | Side camera, prop, animation, on-foot rule          |
| `Config.Coins`                                        | Playtime rewards (coins per cycle, AFK guard)       |
| `Config.Ranks`                                        | Rank tiers & shop discounts                         |
| `Config.DailyDeal`                                    | Deal of the day                                     |
| `Config.WeeklyStreak`                                 | 7-day streak bonus                                  |
| `Config.JobBonus`                                     | On-duty coin bonus per job                          |
| `Config.BonusNotifications`                           | Double-coins (x2) event banners                     |
| `Config.Gifts`                                        | Player-to-player gifting limits                     |
| `Config.Missions`                                     | Daily missions & rewards                            |
| `Config.Shop`                                         | Products, categories & badges                       |
| `Config.Dealership`                                   | VIP dealerships & in-game builder                   |
| `Config.Admin`                                        | Admin groups (builder/admin)                        |
| `Config.Codes`                                        | Who can manage redeem codes                         |
| `Config.Logs`                                         | Discord webhook + DB logging                        |
| `Config.BattlePassIntegration`                        | Season pass via rt-pausemenu                        |
| All options have comments inside `config/config.lua`. |                                                     |

***

### 🛒 Shop

Coin-based store with categories (`featured`, `items`, `perks`, `vehicles`, `limited`), badges, vehicles and perks. Set `Config.Shop.enabled = true` (otherwise it shows a "Coming soon" screen) and add products:

```lua
Config.Shop = {
    enabled = true,            -- false = "Coming soon" screen
    products = {
        {
            id       = 'veh_zentorno',
            name     = 'Pegassi Zentorno',
            category = 'vehicles',     -- featured | items | perks | vehicles | limited
            price    = 3000,
            type     = 'vehicle',      -- items | perk | vehicle | battlepass
            model    = 'zentorno',
            stock    = 5,              -- -1 = unlimited
            enabled  = true,           -- must be true to show
        },
    },
}
```

> Every product field is documented with examples inside `config/config.lua`. Rank discounts from `Config.Ranks` are applied automatically at checkout.

***

### 🚗 VIP Vehicles & Dealership Builder

Physical dealerships are created **in-game** — no coordinates in the config. Everything is stored in `rt_coins_dealerships` / `rt_coins_dealer_vehicles`.

Open the builder (admin only):

```
/coinsbuilder
```

A multi-step wizard creates a dealership and places its points with the gizmo, one after another:

1. **Seller NPC** (required)
2. **Showroom** platform (optional)
3. **Delivery** point (optional — falls back to the NPC)
4. **Test drive** point (optional)

In build mode: **mouse** aims, **wheel** rotates (Shift = fine), **E / ENTER** confirms, **BACKSPACE** skips the optional step.

* **Display vehicles** — add cars to the catalog; optionally show them physically. Each can carry an **image URL** (Fivemanage / direct link) shown in the UI.
* **Showroom visor** — a single gizmo-placed turntable that shows any catalog car one at a time, with a **color picker** to preview and buy in the chosen color. Great for listing many cars without spawning them all.
* **Test drive** — spawns the car at the test-drive spot for `Config.Dealership.testDrive.duration` seconds; leaving the vehicle cancels it and returns the player.
* **Vehicle keys** — if `rt-vehiclekeys` or `tgiann-hotwire` is running, the key is handed over on purchase and revoked after the test drive.

```lua
Config.Dealership = {
    enabled        = true,
    builderCommand = 'coinsbuilder',
    interaction    = 'auto',   -- auto | target | marker
    defaultPedModel = 'a_m_y_business_03',
    testDrive = { duration = 60, plate = 'TEST' },
}
```

***

### 🪙 Coins, Ranks & Rewards

* **Playtime rewards** — coins per active-play cycle, with an AFK guard (`Config.Coins`).
* **Ranks** — spend-based tiers that grant an automatic **shop discount** (`Config.Ranks`).
* **Daily Deal** — one rotating discounted product (`Config.DailyDeal`).
* **Weekly Streak** — complete the 4 daily missions for 7 days for a bonus (`Config.WeeklyStreak`).
* **Job Bonus** — extra coins while on duty for configured jobs (`Config.JobBonus`).
* **Double Coins (x2)** — scheduled events with in-game banners (`Config.BonusNotifications`).

***

### 🎁 Gifts

Players send coins to each other from the Gifts tab, with daily limits and an optional message.

```lua
Config.Gifts = {
    enabled    = true,
    maxPerDay  = 3,       -- gifts a player can send per day
    minAmount  = 10,
    maxAmount  = 1000,
    taxPercent = 0,       -- % fee taken from each gift
}
```

***

### 🎟️ Codes

Redeemable codes that grant **coins** or a **product discount**, with expiry and usage limits. Players redeem from the Codes tab; staff create/list/delete codes from the same tab's management panel.

Who can manage codes is **independent** from general admin, so you can give code management to a support team without giving them the builder:

```lua
Config.Codes = {
    useAdmin = true,                  -- Config.Admin groups can manage too
    groups   = { 'god', 'admin' },    -- framework groups
    aces     = { 'rt.coins.codes' },  -- ACE perms ('rt.coins.admin' always works)
}
```

***

### 🔌 RT Pause Menu integration (optional)

rt-coins is the economy backend for RT Pause Menu. When both are installed:

* The pause menu shows a **coins balance widget** and a **shop button** (dock + profile).
* Wheel/mission rewards pay out in **real coins** instead of the cash fallback.
* The **Battle Pass** premium track can be purchased with coins.

Enable it in **rt-pausemenu**'s config:

```lua
-- rt-pausemenu/config/config.lua
Config.Integrations = {
    coins = { enabled = true, resource = 'rt-coins' },
}
```

> The Battle Pass purchase is the only feature that strictly needs rt-pausemenu (it writes to its `pm_battlepass` table). If rt-pausemenu isn't started, that product type is skipped with a warning; everything else works.

***

### 🧩 Exports

```lua
-- Server
exports['rt-coins']:GetCoins(src)
exports['rt-coins']:AddCoins(src, amount, reason)
exports['rt-coins']:RemoveCoins(src, amount, reason)
exports['rt-coins']:GetCoinsByCitizenId(citizenid)
exports['rt-coins']:RemoveCoinsByCitizenId(citizenid, amount, reason)
exports['rt-coins']:GetPlayerRankId(src)

-- Client
exports['rt-coins']:OpenTablet(section)   -- section e.g. 'shop', 'vehicles'
exports['rt-coins']:IsTabletOpen()
```

Integration hooks used by rt-pausemenu:

```lua
-- Server callback (pause-menu widget info)
'rt-coins:server:getPauseMenuInfo'
-- Client event (open the tablet from another resource)
'rt-coins:client:openTablet'
```

***

### 👮 Admin & permissions

Admin powers (open the dealership builder, etc.) are granted to framework groups or ACE.

```lua
Config.Admin = { groups = { 'god', 'admin', 'mod' } }
```

* ACE: `rt.coins.admin` is always recognized.
* Dealership builder: `/coinsbuilder` (requires admin).
* Code management: separate `Config.Codes` permission block (see Codes).

***

### 📁 Config files

| File                   | Purpose                       |
| ---------------------- | ----------------------------- |
| `config/config.lua`    | All settings                  |
| `bridge/framework.lua` | Framework bridge (qbx/qbcore) |
| `locales/*.json`       | UI + server translations      |
| `sql/install.sql`      | Optional manual table import  |

***

### 🛠️ Troubleshooting

| Symptom                            | Fix                                                                           |
| ---------------------------------- | ----------------------------------------------------------------------------- |
| Tablet won't open                  | You're in a vehicle (on foot only), or set a command/key in `Config.Keybinds` |
| `attempt to index nil` (framework) | Start qbx\_core/qb-core, or set `Config.Framework`                            |
| `rt_coins*` table errors           | Configure oxmysql connection                                                  |
| UI changes not showing             | Clear NUI cache                                                               |
| Dealership not interactable        | Ensure `ox_target` is started, or use `interaction = 'marker'`                |
| No vehicle key after buying        | Install `rt-vehiclekeys` or `tgiann-hotwire` (optional)                       |
| Battle Pass product missing        | Start `rt-pausemenu` (required only for the pass)                             |

***

### ❤️ Support

Developed by RT Dev. Support through your Tebex purchase channel. © RealTime Dev — all rights reserved.


---

# 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://realtime-dev.gitbook.io/realtime-dev-docs/realtime-scripts/rt-coins.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.
