> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-prison/developer-guide/jailing-players.md).

# Jailing Players

Send players to Bolingbroke from your police job, MDT or scripts.

Sentences are passed in **real minutes**; players see **months** (`Config.Sentence.displayScale` months per minute). `JailPlayer(src, 5)` reads as "sentenced to 5 months" in-game.

{% tabs %}
{% tab title="Export" %}

```lua
-- server-side
exports.mango_prison:JailPlayer(source, 5, {
    reason  = 'Armed robbery',
    officer = 'Officer Smith',
    cell    = 'A3',            -- optional; auto-assigned otherwise
})
```

{% endtab %}

{% tab title="Server event" %}

```lua
-- server-side (AddEventHandler-registered: clients cannot spoof it)
TriggerEvent('mango_prison:jailPlayer', source, 5, { reason = 'Armed robbery' })
```

{% endtab %}

{% tab title="Offline player" %}

```lua
-- target can be a character identifier (citizenid / ESX identifier):
-- the sentence is applied and intake runs on their next login.
exports.mango_prison:JailPlayer('ABCD1234', 30, { reason = 'Warrant backlog' })
```

{% endtab %}
{% endtabs %}

## Framework compatibility (zero-code)

Anything on your server that jails "the framework way" already works:

| Framework | Intercepted                                                                      | Unit    |
| --------- | -------------------------------------------------------------------------------- | ------- |
| ESX       | `esx_jail:sendToJail(playerId, seconds)`                                         | seconds |
| QB / Qbox | `police:server:JailPlayer(playerId, minutes)` — validated as coming from a guard | minutes |

That covers qb-policejob's jail command out of the box, and most MDTs that jail through the framework. Toggle in `Config.Compat`.

{% hint style="info" %}
**Sentencing from an MDT has its own page.** [Mango MDT](/mango5m-docs/resources/mango-mdt.md) does *not* use the framework events — it binds a jail provider directly, and ps-mdt fires a client event that cannot be intercepted here at all.

See [**Jailing from an MDT**](/mango5m-docs/resources/mango-prison/developer-guide/jailing-from-an-mdt.md) for Mango MDT, ps-mdt and codem mMDT AIO.
{% endhint %}

## Releasing

```lua
exports.mango_prison:ReleasePlayer(target, 'sentence overturned')
-- or: TriggerEvent('mango_prison:releasePlayer', target, reason)
```

Releases restore the previous job, all stored property and the saved appearance — even if the player is offline (finalised on next login). Time served releases happen automatically.

{% hint style="info" %}
Every public event also answers to the `mango_corrections:*` prefix if you prefer that naming.
{% endhint %}
