Skip to the content
Docs

Prison Scripts

On this page8

How the Police prison choice works, which prison scripts are supported, and how to connect another one. The Admin jail is built into the panel and needs none of this: see Jail.

What staff see

When staff press Jail on a player, they choose Which jail:

ChoiceWho runs the sentence
Admin jailThe panel. The spot and the radius come from Config.AdminJail.
Police prisonYour server's own prison script. The panel only hands the player over.

Police prison is only shown when the panel finds a prison script. Without one, staff get the admin jail only.

Supported: qb-prison

StepWhat the panel does
Send to prisonSets the player's jail time, then starts the prison. With qb-policejob running it goes through the police job (police:client:SendToJail). Without it, straight to qb-prison (prison:client:Enter).
ReleaseTells qb-prison to let the player out (prison:client:UnjailPerson).
StatusReads the minutes left from the player's injail value.

Supported: xt-prison

xt-prison is the prison a new Qbox server comes with. It also runs on QBCore and ESX.

StepWhat the panel does
Send to prisonAsks xt-prison to take the player in, the same way its own /jail does. xt-prison then does everything itself: its cells, its prison clothes, its welcome text.
Send again while insideOnly the time changes.
ReleaseAsks xt-prison to let the player out now, like its own /unjail. The player stands at xt-prison's exit point.
StatusReads the time left from the player's jailTime value.

While a player is in prison

Their profile shows Police prison with the minutes left, and the Jail button becomes Release from jail. The player list says "In police prison".

Admin jail and police prison side by side

Admin jailPolice prison
Who counts the timeThe panelThe prison script
Place and rulesConfig.AdminJailThe prison script
Notice to the playerFrom the panelFrom the prison script
Player must be online to be sentYesYes
Release while the player is offlineYesNo
After the sentencePut back where they stoodThe prison script decides
In the logYesYes

The longest sentence from the panel is one week (10080 minutes), for both.

What staff may read

MessageWhy
"This server has no police prison connected."No prison script was found.
"The prison script did not accept that."The prison script refused, or the lines in bridge/jail.lua failed.
"This player is not in jail."Release from jail was pressed, but the player's time was already over.

Adding another prison script

bridge/jail.lua is open and runs on the server. It has four marked places: -- [[ ADD YOUR PRISON SCRIPT HERE ]]. Fill in all four.

In the snippets, my-prison and its exports are placeholders. Use the names from your prison script's own documentation.

1. Find it

lua
function JailBridge.System()
    if GetResourceState('qb-prison') == 'started' then return 'qb-prison' end
    if GetResourceState('xt-prison') == 'started' then return 'xt-prison' end
    if GetResourceState('my-prison') == 'started' then return 'my-prison' end
    return nil
end

2. Send a player to prison (inside JailBridge.Jail, before the last return false)

lua
    if system == 'my-prison' then
        exports['my-prison']:jail(src, minutes, reason)
        return true
    end

3. Release a player (inside JailBridge.Unjail)

lua
    if system == 'my-prison' then
        exports['my-prison']:unjail(src)
        return true
    end

4. Say how long is left (inside JailBridge.Status)

lua
    if system == 'my-prison' then
        return tonumber(exports['my-prison']:getMinutesLeft(src)) or 0
    end

Then restart 5code-adminpanel.

FunctionGetsMust return
JailBridge.System()NothingThe name of the running prison script, or nil
JailBridge.Jail(src, minutes, reason)An online player, whole minutes, the reason texttrue when the prison script took the player
JailBridge.Unjail(src)An online playertrue when the player is out
JailBridge.Status(src)An online playerMinutes still to serve, or 0 when not in prison

Settings

The admin jail and how to switch it off: Jail. The function list for developers: Bridge Files.