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

# Configuration file

All options live in `config.lua`. The file is loaded on both client and server and is listed in `escrow_ignore`, so you can edit it freely.

{% hint style="info" %}
Options are read at startup. Restart the resource after every change.
{% endhint %}

***

## Framework and key

```lua
Config.Framework = 'auto'
Config.Key = 'M'
```

| Option             | Type   | Default  | Description                                                                                              |
| ------------------ | ------ | -------- | -------------------------------------------------------------------------------------------------------- |
| `Config.Framework` | string | `'auto'` | `'auto'`, `'esx'`, `'qb'` or `'standalone'`. `auto` checks `es_extended`, then `qb-core`.                |
| `Config.Key`       | string | `'M'`    | Default key that opens the compose window. Players can rebind it in **Settings → Key Bindings → FiveM**. |

## Items

```lua
Config.Items = {
    name = 'pager',
    requireItem = true,
    usable = true,
}
```

| Option        | Type    | Default   | Description                                                                                          |
| ------------- | ------- | --------- | ---------------------------------------------------------------------------------------------------- |
| `name`        | string  | `'pager'` | Inventory item name.                                                                                 |
| `requireItem` | boolean | `true`    | Player needs the item to open the pager and to **receive** messages. Players without it are skipped. |
| `usable`      | boolean | `true`    | Registers the item as usable (ESX / QBCore). Using it opens the compose window.                      |

## Messages

```lua
Config.Messages = {
    enabled = true,
    receiveOnly = false,
    command = 'pager',
    maxLength = 120,
    duration = 8000,
    cooldown = 3000,
    queueLimit = 5,
    requireItem = true,
    showSender = false,
    format = '%s: %s',
    sendToSelf = false,
    confirmToSender = true,
    jobs = {
        police = 0,
    },
    blockedJobs = {
        unemployed = true,
    },
}
```

| Option            | Type    | Default      | Description                                                                                |
| ----------------- | ------- | ------------ | ------------------------------------------------------------------------------------------ |
| `enabled`         | boolean | `true`       | Enables job messages, the command and the key binding.                                     |
| `receiveOnly`     | boolean | `false`      | Pagers only receive. The compose window shows history but the input is locked.             |
| `command`         | string  | `'pager'`    | Command that opens the compose window.                                                     |
| `maxLength`       | number  | `120`        | Maximum message length in characters.                                                      |
| `duration`        | number  | `8000`       | How long (ms) a job message stays on screen.                                               |
| `cooldown`        | number  | `3000`       | Time (ms) between two messages from the same player.                                       |
| `queueLimit`      | number  | `5`          | Maximum number of messages waiting while another one is shown. Extra messages are dropped. |
| `requireItem`     | boolean | `true`       | Sender needs the item (checked on the server).                                             |
| `showSender`      | boolean | `false`      | Adds the sender's name to the message using `format`.                                      |
| `format`          | string  | `'%s: %s'`   | Format used with `showSender`. First `%s` is the name, second is the text.                 |
| `sendToSelf`      | boolean | `false`      | The sender also receives their own message.                                                |
| `confirmToSender` | boolean | `true`       | Shows `Message sent to X pager(s).` to the sender.                                         |
| `jobs`            | table   | `police = 0` | Jobs allowed to send, with the minimum grade. See below.                                   |
| `blockedJobs`     | table   | `unemployed` | Jobs that can never send. Always wins over `jobs`.                                         |

### Job rules

```lua
jobs = {
    police = 0,      -- every police grade can send
    ambulance = 2,   -- ambulance from grade 2
    mechanic = false -- mechanic cannot send
},
```

* **Empty table** (`jobs = {}`) – every job can send, no grade limit (except `blockedJobs`).
* **Job listed with a number** – job can send from that grade up.
* **Job not listed or `false`** – job cannot send.

{% hint style="info" %}
Messages always go only to players with **the same job** as the sender.
{% endhint %}

## Sound

```lua
Config.Sound = {
    enabled = true,
    name = 'Beep_Red',
    set = 'DLC_HEIST_HACKING_SNAKE_SOUNDS',
    count = 2,
    delay = 260,
}
```

| Option    | Type    | Default                            | Description                         |
| --------- | ------- | ---------------------------------- | ----------------------------------- |
| `enabled` | boolean | `true`                             | Plays a sound on incoming messages. |
| `name`    | string  | `'Beep_Red'`                       | GTA frontend sound name.            |
| `set`     | string  | `'DLC_HEIST_HACKING_SNAKE_SOUNDS'` | GTA sound set.                      |
| `count`   | number  | `2`                                | Number of beeps.                    |
| `delay`   | number  | `260`                              | Delay (ms) between beeps.           |

## Animation

```lua
Config.Animation = {
    send = true,
    receive = false,
}
```

| Option    | Type    | Default | Description                                      |
| --------- | ------- | ------- | ------------------------------------------------ |
| `send`    | boolean | `true`  | Take out the pager prop while writing a message. |
| `receive` | boolean | `false` | Take out the pager prop when a message comes in. |

You can also set `Config.Animation = true` or `false` to toggle both.

{% hint style="warning" %}
Animations and the prop are disabled in standalone mode.
{% endhint %}

## History

```lua
Config.History = {
    limit = 10,
    storeSent = true,
    sentPrefix = '> ',
}
```

| Option       | Type    | Default | Description                                         |
| ------------ | ------- | ------- | --------------------------------------------------- |
| `limit`      | number  | `10`    | Messages kept in the history. `0` disables history. |
| `storeSent`  | boolean | `true`  | Also stores messages you sent.                      |
| `sentPrefix` | string  | `'> '`  | Prefix for your own messages in the history.        |

History is stored on the client only and is cleared on reconnect.

## Timing

```lua
Config.Timing = {
    defaultDuration = 8000,
    hideDelay = 800,
    queueDelay = 500,
    loadTimeout = 5000,
}
```

| Option            | Type   | Default | Description                                                      |
| ----------------- | ------ | ------- | ---------------------------------------------------------------- |
| `defaultDuration` | number | `8000`  | Display time (ms) when `ShowPager` is called without a duration. |
| `hideDelay`       | number | `800`   | Length (ms) of the hide animation.                               |
| `queueDelay`      | number | `500`   | Pause (ms) before the next queued message.                       |
| `loadTimeout`     | number | `5000`  | Max time (ms) to load the prop model and animations.             |

## Logs

```lua
Config.Log = {
    console = true,
    webhook = '',
    webhookName = 'mr_pager',
    webhookColor = 3066993,
}
```

| Option         | Type    | Default      | Description                                       |
| -------------- | ------- | ------------ | ------------------------------------------------- |
| `console`      | boolean | `true`       | Prints every sent message to the server console.  |
| `webhook`      | string  | `''`         | Discord webhook URL. Empty disables Discord logs. |
| `webhookName`  | string  | `'mr_pager'` | Bot username.                                     |
| `webhookColor` | number  | `3066993`    | Embed color (decimal).                            |

The embed contains the job, message, sender name and id, grade and number of receivers.

## Notifications

```lua
Config.NotifyStyle = 'auto'
Config.NotifyDuration = 5000
```

| Option                  | Type   | Default  | Description                                                     |
| ----------------------- | ------ | -------- | --------------------------------------------------------------- |
| `Config.NotifyStyle`    | string | `'auto'` | `'auto'` (framework), `'esx'`, `'qb'` or `'native'` (GTA feed). |
| `Config.NotifyDuration` | number | `5000`   | Notification duration (ms).                                     |

If the framework notification fails, the native GTA feed is used.

## Locale

```lua
Config.Notify = {
    noItem = 'You do not have a pager on you.',
    noJob = 'You have no job to send a message to.',
    jobNotAllowed = 'Your job cannot use the pager.',
    receiveOnly = 'This pager can only receive messages.',
    gradeTooLow = 'Your rank is too low to use the pager.',
    cooldown = 'Wait a moment before sending another message.',
    emptyMessage = 'Your message is empty.',
    sent = 'Message sent to %d pager(s).',
}
```

Translate the values, never change the keys. `sent` must keep the `%d` placeholder.
