> 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/exports.md).

# Exports

Exports with args and returns.

***

## Client exports

### ShowPager(message, duration)

Shows a message on the pager screen. If another message is visible or the compose window is open, the message is queued.

```lua
exports['mr_pager']:ShowPager(message, duration)
```

#### **Arguments:**

* `message` (string) – Text to display.
* `duration` (number, optional) – Display time in ms. Default `Config.Timing.defaultDuration`.

#### **Returns:**

* nothing

{% hint style="info" %}
With `Config.Items.requireItem = true` the message is not shown to a player without the item.
{% endhint %}

### HidePager()

Hides the currently shown message and shows the next one from the queue.

```lua
exports['mr_pager']:HidePager()
```

#### **Returns:**

* nothing

### OpenCompose()

Opens the compose window (same as the key / command).

```lua
exports['mr_pager']:OpenCompose()
```

#### **Returns:**

* (boolean) – `true` if the window opened, `false` if it was already open, messages are disabled, the player has no item or no job.

### CloseCompose()

Closes the compose window.

```lua
exports['mr_pager']:CloseCompose()
```

#### **Returns:**

* (boolean) – `true` if the window was open and is now closed.

### SendJobMessage(text)

Sends a message to the player's job. All checks run on the server.

```lua
exports['mr_pager']:SendJobMessage(text)
```

#### **Arguments:**

* `text` (string) – Message text. Line breaks are removed, text is cut to `Config.Messages.maxLength`.

#### **Returns:**

* (boolean) – `true` if the request was sent to the server, `false` if the text is empty or the pager is receive-only.

### TakeOutPager()

Plays the take-out animation and attaches the prop to the player's hand.

```lua
exports['mr_pager']:TakeOutPager()
```

#### **Returns:**

* (boolean) – `true` on success. `false` if animations are disabled, the pager is already out or the prop could not load.

{% hint style="warning" %}
`TakeOutPager`, `PutAwayPager` and `TogglePager` wait for the animation. Call them inside a thread (`CreateThread`).
{% endhint %}

### PutAwayPager()

Plays the put-away animation and removes the prop.

```lua
exports['mr_pager']:PutAwayPager()
```

#### **Returns:**

* (boolean) – `true` on success, `false` if the pager is not out.

### TogglePager()

Takes the pager out or puts it away. Checks for the item before taking it out.

```lua
exports['mr_pager']:TogglePager()
```

#### **Returns:**

* (boolean) – Result of `TakeOutPager` / `PutAwayPager`, or `false` if the player has no item.

### IsPagerOut()

```lua
exports['mr_pager']:IsPagerOut()
```

#### **Returns:**

* (boolean) – `true` if the prop is in the player's hand.

### HasPagerItem()

```lua
exports['mr_pager']:HasPagerItem()
```

#### **Returns:**

* (boolean) – `true` if the player has the item. Always `true` in standalone mode or with `Config.Items.requireItem = false`.

### GetFramework()

```lua
exports['mr_pager']:GetFramework()
```

#### **Returns:**

* (string) – `'esx'`, `'qb'` or `'standalone'`.

***

## Server exports

### SendJobMessage(source, text)

Sends a message as a player to everyone with the same job. Runs every check: enabled, receive-only, cooldown, item, job, grade.

```lua
local count, reason = exports['mr_pager']:SendJobMessage(source, text)
```

#### **Arguments:**

* `source` (number) – Player server id (the sender).
* `text` (string) – Message text.

#### **Returns:**

* `count` (number | nil) – Number of players who received the message. `nil` on failure.
* `reason` (string | nil) – Failure reason when `count` is `nil`:

| Reason          | Meaning                                            |
| --------------- | -------------------------------------------------- |
| `'disabled'`    | `Config.Messages.enabled = false`.                 |
| `'receiveonly'` | `Config.Messages.receiveOnly = true`.              |
| `'empty'`       | Text is empty, not a string or too long.           |
| `'cooldown'`    | Player sent a message less than `cooldown` ms ago. |
| `'noitem'`      | Player has no pager item.                          |
| `'nojob'`       | Player data or job not found.                      |
| `'notallowed'`  | Job not in `jobs` or in `blockedJobs`.             |
| `'grade'`       | Player's grade is below the job's minimum.         |

{% hint style="info" %}
The server export does not show notifications to the player. Use the `reason` to handle it yourself.
{% endhint %}
