STG ScriptsDocumentation
Jail System

Configuration

Every option in STG Jail System config.lua and customize.lua, from the menu key and the NPC police transport to cells, release points, kept items and notifications.

All settings live in stg_jail/config.lua, which is the same in the ESX and QBCore versions. Notifications are set in stg_jail/customize.lua. Both files stay editable in the escrow version. Restart the resource after a change.

Language

STG.Language = "en"

STG.Locale = {
    ["en"] = {
        release = "~b~You Will Release at: ",
        released = "You are free now!"
    },
    ["de"] = {
        release = "~b~You Will Release at: ",
        released = "You are free now!"
    }
}

The texts are in the config itself. STG.Language picks one of the STG.Locale entries: en or de. The de entry ships with the English text, so translate it or add your own language as a new entry with the same two keys.

Prop

Type

STG.withCommand = true
STG.command = "jail"

STG.withKey = true
STG.key = "f6"

Only players with the police job can open the menu. The menu lists the closest player within 3 metres. The officer picks JAIL or PRISON, enters the time in minutes and presses COMPLETE.

Prop

Type

Police transport

STG.DeliveryDistance = 10.0
STG.spawnRadius = 100.0
STG.policeStation = vector4(445.424164, -1019.815369, 28.218262, 280.629913)

STG.policeNPCs = {
    "s_m_m_prisguard_01"
}

STG.policeCars = {
    "police",
    "police2"
}

When a player is sentenced, a patrol car with its siren on spawns near them and drives up. Within 10 metres the officer gets out, arrests the player and both get in the car. The officer then drives to policeStation while the player's controls are locked.

Prop

Type

Cells and release points

STG.detentionCoords = {
    vector4(459.283508, -997.819763, 24.898926, 269.291351)
}
STG.jailCoords = {
    vector4(1790.400024, 2574.619873, 45.792725, 90.708656)
}
STG.releasePoints = {
    vector4(425.340668, -979.806580, 30.695190, 82.204727)
}

Each list can hold as many points as you like. A random one is used every time, and the fourth value is the heading the player faces.

Prop

Type

Vehicle keys

function addKey(vehicle, plate)
    if GetResourceState('qb-vehiclekeys') == 'started' then
        TriggerEvent("vehiclekeys:client:SetOwner", plate)
    else
        -- your code here
    end
end

Runs on the sentenced player's game when the patrol car spawns, with the car and its plate. With qb-vehiclekeys started, it gives the player the keys to that plate. If you use another key script, put its call in the else branch.

Kept items

STG.whitelistItems = {
    "bread",
    "water"
}

When the player reaches the cell, every item in their inventory is taken, except the item names in this list. The taken items are given back on release.

Prisoner outfit

STG.prisonerClothes = {
    ["male"] = {
        tshirt_1 = 15,
        tshirt_2 = 0,
        torso_1  = 146,
        torso_2  = 0,
        decals_1 = 0,
        decals_2 = 0,
        arms     = 0,
        pants_1  = 3,
        pants_2  = 7,
        shoes_1  = 12,
        shoes_2  = 12,
        chain_1  = 50,
        chain_2  = 0
    },
    ["female"] = {
        -- same keys
    }
}

Prison clothes for each gender, written with the skinchanger component names. The _1 value is the drawable and the _2 value is the texture.

Drawable ids depend on the clothing packs your server streams, so check them in your clothing menu before changing them.

Notifications

stg_jail/customize.lua turns a text key into the line from STG.Locale with getMessage and shows it as a notification:

RegisterNetEvent('stg_jail:notify')
AddEventHandler('stg_jail:notify', function(message)
    ESX.Functions.Notify(getMessage(message))
end)
RegisterNetEvent('stg_jail:notify')
AddEventHandler('stg_jail:notify', function(message)
    Framework.ShowNotification(getMessage(message))
end)

Replace the line inside the handler to use your own notification system.

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page