# Jail System

## JailPlayer

Use following export to jail some player.

```lua
exports['p_policejob']:JailPlayer(officerId, data)
```

* officerId: `number`
  * Existing officer id
* data: `table`
  * player: `number`
  * jail: `number`
  * fine: `number`
  * reason: `string`
  * offenses?: `{ [string]: offenseData }`

### offenseData

* fine: `number`
* label: `string`
* jail: `number`
* count: `number`

Return:

* state: `boolean` or `nil`

{% hint style="warning" %}
Offenses are only required to display it properly in our Police MDT.
{% endhint %}

***

## JailPlayers

Use following export to jail few players at the same time.

```lua
exports['p_policejob']:JailPlayers(officerId, data)
```

* officerId: `number`
  * Existing officer id
* data: `table`
  * players: `{ [index]: { identifier: string } }`
  * jail: `number`
  * fine: `number`
  * reason: `string`
  * offenses?: `{ [string]: offenseData }`

### offenseData

* fine: `number`
* label: `string`
* jail: `number`
* count: `number`

Return:

* state: `boolean` or `nil`

{% hint style="warning" %}
Offenses are only required to display it properly in our Police MDT.
{% endhint %}

***

## Jail Command

Use following command to jail player \[required permissions in config]

```lua
/jail targetId months
```

* targetId: `number`
  * Existing player server id
* months: `number`
  * Amount of months in jail

***

## Unjail Player

Use following export to unjail player.

```lua
exports['p_policejob']:UnJailPlayer(playerId, targetId)
```

* playerId: `number or nil`
  * Existing player server id
* targetId: `number`
  * Existing player server id in jail

***

## Unjail Command

Use following command to unjail player \[required permissions in config].

```lua
/unjail targetId
```

* targetId: `number`
  * Existing player server id in jail

***

## Shorten Jail

Use following export to shorten player jail.

```lua
exports['p_policejob']:ShortenJailPlayer(playerId, targetId, months)
```

* playerId: `number or nil`
  * Existing player server id
* targetId: `number`
  * Existing player server id in jail
* months: `number`
  * Amount of months to shorten

***

## Shorten Jail Command

Use following command to shorten jail player \[required permissions in config].

```lua
/shortjail targetId months
```

* targetId: `number`
  * Existing player server id in jail
* months: `number`
  * Amount of months to shorten

***

## inJail

Check if player is currently in jail.

```lua
Player(playerId).state.inJail
```

* playerId: `number`
  * Existing player server id

Return:

* state: `boolean`

## getPlayerJudgment

Check player remaining amount of months in jail.

```lua
exports['p_policejob']:getPlayerJudgment(playerId)
```

* playerId: `number`
  * Existing player server id

Return:

* months: `number` or `0`


---

# Agent Instructions: 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:

```
GET https://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/police-job/server-exports/jail-system.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
