> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/mad-racing-system-racing-tablet/configuration.md).

# Configuration

## cfg.lua Reference

One file, seventeen numbered sections. Every option is annotated in place — this page is the map, not a copy of it.

{% hint style="warning" %}
Webhooks belong in `server/webhook.lua`.
{% endhint %}

***

### Sections

| #  | Section                  | What it controls                                                                            |
| -- | ------------------------ | ------------------------------------------------------------------------------------------- |
| 1  | Framework & dependencies | Framework detection, notification / text UI / vehicle key / dispatch adapters, police alert |
| 2  | Tablet & UI              | Command name, tablet item, Leaflet map tiles                                                |
| 3  | Economy                  | `cash` or `bank` for fees and prizes                                                        |
| 4  | User tiers & permissions | The tier ladder and the minimum tier per capability                                         |
| 5  | Player profile defaults  | Avatars, checkpoint and GPS colours, checkpoint styles, crew emblems                        |
| 6  | ELO rating               | Starting rating, K-factor, minimum participants                                             |
| 7  | Race engine              | Countdown, DNF timeout, traffic cleanup, starting grid layout                               |
| 8  | Race types               | The six formats and their flags                                                             |
| 9  | Drift scoring            | Angle, speed, combo multiplier, wall penalty                                                |
| 10 | Tracks                   | Creator limits, track tags, placeable props                                                 |
| 11 | Competitions             | Auto-schedule slots, prize pool and split, vehicle classes                                  |
| 12 | Pink slips               | Allowed formats, DNF rule, redeem locations                                                 |
| 13 | Bounties                 | Interval, expiry, prize, target time formula                                                |
| 14 | Item payouts             | Weighted item pools and payout style                                                        |
| 15 | 3D GPS                   | Lookahead, default style, ribbon presets                                                    |
| 16 | Discord webhooks         | Pointer only — config lives in `server/webhook.lua`                                         |
| 17 | Limits                   | Page sizes and list caps for tablet queries                                                 |

***

### The ones that matter on day one

**`cfg.permissions`** decides who can do what. Each capability names a minimum tier:

```lua
cfg.permissions = {
    join             = 'Racer',
    create           = 'Racer',
    createTrack      = 'Creator',
    createCrew       = 'Racer',
    control          = 'Master',
    controlAll       = 'God',
    handleBounties   = 'Master',
    runAdminCommands = 'God',
}
```

Tiers are ranked by **index** in `cfg.tiers`, not by name — first entry is highest, last is the default. A tier granted with `createracinguser` overrides whatever the player's ELO would give them.

**`cfg.competition.autoSchedule`** is a list of server-time `HH:MM` slots. The scheduler pre-creates a lobby for each one, opens it `lobbyDurationSec` before the start, then auto-starts it if anyone joined and auto-cancels it if nobody did. Set it to `{}` to turn the scheduler off.

**`cfg.playerCard.enabled`** ships **off**. Each visible nameplate is its own CEF instance; in a crowded area the cost adds up fast. If you turn it on, drop `maxConcurrent` from `10` to `3`–`4` first.

**`cfg.moneyType`** applies to every fee and prize in the script.

***

### Race type flags

`cfg.raceTypes` defines the six formats. The flags drive the engine:

| Flag          | Effect                                   |
| ------------- | ---------------------------------------- |
| `circuit`     | Track loops; laps become selectable      |
| `drift`       | Drift score decides the winner, not time |
| `timeTrial`   | Solo, no lobby                           |
| `elimination` | Last racer is dropped each lap           |

Removing an entry from this list removes it from the tablet.

***

### Checkpoint radius

Two different things, often confused:

* **`cp.radius`** — per-checkpoint, set in the editor. This is the trigger.
* **The visual pillar** — fixed size, purely cosmetic.

Making the pillar bigger does not make the checkpoint easier to hit. Edit the radius in the track editor instead.

On foot, `cfg.race.checkpointArriveDistance` is used instead of `cp.radius`.
