Server

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

Exports (General)

List of general exports.

Jail

SERVER

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

Example code

server.lua
local playerId = 1 -- playerId
local jailTime = 5 -- 5 minutes
local jailReason = 'multiple felonies' -- jailReason is optional, not needed

exports['rcore_prison']:Jail(playerId, jailTime, jailReason)

Unjail

SERVER

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

Example code

server.lua
local playerId = 1
local skipTeleport = true -- If you dont want to teleport in front of Prison

exports['rcore_prison']:Unjail(playerId, skipTeleport)

UnjailOffline

SERVER

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

Example code

server.lua
local charId = "ZW32561A"

exports['rcore_prison']:UnjailOffline(charId)

GetPrisonerData

SERVER

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

Example code

server.lua
local playerId = 1
local data = exports['rcore_prison']:GetPrisonerData(playerId)

--- {

--- state: string,
--- officerName: string,
--- owner: string,
--- id: int,
--- jail_time: float,
--- source: int,
--- prisonerName: string,
--- jail_reason: string,
 

--- }: table

EditPrisonerSentence

SERVER

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

Example code

server.lua
local playerId = 1
local amount = 10 -- Set target player sentence
exports['rcore_prison']:EditPrisonerSentence(playerId, amount)

IsPrisoner

SERVER

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

Example code

server.lua
local playerId = 1
local state = exports['rcore_prison']:IsPrisoner(playerId)

if state then
    print('Player is prisoner')
else
    print('Player is citizen')
end

AddCredits

SERVER

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

Example code

server.lua
local playerId = 1
local giveAmonunt = 500

exports['rcore_prison']:AddCredits(playerId, giveAmonunt)

RemoveCredits

SERVER

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

Example code

server.lua
local playerId = 1
local removeAmount = 500

exports['rcore_prison']:RemoveCredits(playerId, removeAmount)

SetSolitary

SERVER

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

Example code

server.lua
local playerId = 1
local sentenceAmount = 5 -- This is 5 mins by default
local sentenceReason = 'Attacked Prison Guard' -- optional, not requred

exports['rcore_prison']:SetSolitary(playerId, sentenceAmount)

ReleaseFromSolitary

SERVER

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

Example code

server.lua
local playerId = 1

exports['rcore_prison']:ReleaseFromSolitary(playerId)

IsPrisonerInSolitary

SERVER

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

Example code

server.lua
local playerId = 1
local state=  exports['rcore_prison']:IsPrisonerInSolitary(playerId)

if state then
    print('Prisoner is in solitary cell')
end

Last updated