Server

This page lists all the available server-side events and exports.

Events (General)

Prison Action Listener

SERVER

This event is listener for actions happening in prison.

Example code

server.lua

--- 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,
-- }

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)

Exports (General)

List of general exports.

Jail

SERVER

This export is used when you want to jail target citizen.

Example code

Unjail

SERVER

This export is used when you want to unjail citizen which is in Prison.

Example code

UnjailOffline

SERVER

This export is used when you want to unjail citizen which is offline

Example code

GetPrisonerData

SERVER

This export is used when you want to get more informations about target prisoner.

Example code

EditPrisonerSentence

SERVER

This export is used when you want to modify target prisoner sentence

Example code

IsPrisoner

SERVER

This export is used when you want to check if target citizen is Prisoner

Example code

AddCredits

SERVER

This export is used when you want to give target Prisoner credits, if he has account!

Example code

RemoveCredits

SERVER

This export is used when you want to remove credits from Prisoner account.

Example code

SetSolitary

SERVER

This export is used when you want to sent Prisoner to Solitary cell

Example code

ReleaseFromSolitary

SERVER

This export is used when you want to release prisoner from solitary

Example code

IsPrisonerInSolitary

SERVER

This export is used when you want to check if Prisoner is in Solitary cell

Example code

StartCOMS

SERVER

This export is used when you want to send citizen to Community service

Example code

Last updated

Was this helpful?