Server
Server-side events and exports exposed by rcore_prison. Call them from other resources running on the same server.
📡 Events
Prison Action Listener
This event is listener for actions happening in prison.
--- Action Types ---
-- PRISONER_RELEASED: Player is released from prison
-- PRISONER_LOADED: Player rejoins and is jailed since they have a remaining sentence
-- PRISONER_NEW: New player is jailed
-- PLAYER_ESCAPE_FROM_PRISON: Player escaped from prison (Prison break)
-- PLAYER_DESTROYED_WALL: Player destroyed a wall in prison (Prison break)
--- Prisoner Data Structure ---
-- data.prisoner: {
-- state: string,
-- officerName: string,
-- owner: string,
-- id: int,
-- jail_time: float,
-- source: int,
-- prisonerName: string,
-- jail_reason: string,
-- }
---@param actionType string
---@param data table
AddEventHandler('rcore_prison:server:heartbeat', function(actionType, data)
-- Your event handling logic here
if not next(data) then
return
end
local prisoner = data.prisoner
if not prisoner then
return
end
if actionType == 'PRISONER_NEW' then
print('New prisoner loaded')
end
end)🔒 Jail
Jail
This export is used when you want to jail target citizen.
---@param playerId number
---@param jailTime number - jail time in minutes
---@param jailReason? string - optional, not needed
---@param officerPlayerId? number - optional, if used it will be logged in ./jailcp Logs
local playerId = 1 -- playerId
local jailTime = 5 -- 5 minutes
local jailReason = 'multiple felonies' -- jailReason is optional, not needed
local officerPlayerId = 2 -- officerPlayerId is optional, if used it will be logged in ./jailcp Logs
exports['rcore_prison']:Jail(playerId, jailTime, jailReason, officerPlayerId)Unjail
This export is used when you want to unjail citizen which is in Prison.
---@param playerId number
---@param skipTeleport? bool - if true, does not teleport the player in front of the prison
local playerId = 1
local skipTeleport = true -- If you dont want to teleport in front of Prison
exports['rcore_prison']:Unjail(playerId, skipTeleport)UnjailOffline
This export is used when you want to unjail citizen which is offline
---@param charId string
local charId = "ZW32561A"
exports['rcore_prison']:UnjailOffline(charId)📋 Prisoner Data
💰 Credits
🚫 Solitary
👮 Community Service
Last updated