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:
| Choice | Who runs the sentence |
|---|---|
| Admin jail | The panel. The spot and the radius come from Config.AdminJail. |
| Police prison | Your 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
| Step | What the panel does |
|---|---|
| Send to prison | Sets 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). |
| Release | Tells qb-prison to let the player out (prison:client:UnjailPerson). |
| Status | Reads 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.
| Step | What the panel does |
|---|---|
| Send to prison | Asks 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 inside | Only the time changes. |
| Release | Asks xt-prison to let the player out now, like its own /unjail. The player stands at xt-prison's exit point. |
| Status | Reads 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 jail | Police prison | |
|---|---|---|
| Who counts the time | The panel | The prison script |
| Place and rules | Config.AdminJail | The prison script |
| Notice to the player | From the panel | From the prison script |
| Player must be online to be sent | Yes | Yes |
| Release while the player is offline | Yes | No |
| After the sentence | Put back where they stood | The prison script decides |
| In the log | Yes | Yes |
The longest sentence from the panel is one week (10080 minutes), for both.
What staff may read
| Message | Why |
|---|---|
| "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
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
end2. Send a player to prison (inside JailBridge.Jail, before the last return false)
if system == 'my-prison' then
exports['my-prison']:jail(src, minutes, reason)
return true
end3. Release a player (inside JailBridge.Unjail)
if system == 'my-prison' then
exports['my-prison']:unjail(src)
return true
end4. Say how long is left (inside JailBridge.Status)
if system == 'my-prison' then
return tonumber(exports['my-prison']:getMinutesLeft(src)) or 0
endThen restart 5code-adminpanel.
| Function | Gets | Must return |
|---|---|---|
JailBridge.System() | Nothing | The name of the running prison script, or nil |
JailBridge.Jail(src, minutes, reason) | An online player, whole minutes, the reason text | true when the prison script took the player |
JailBridge.Unjail(src) | An online player | true when the player is out |
JailBridge.Status(src) | An online player | Minutes 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.