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-- playerIdlocal jailTime =5-- 5 minuteslocal jailReason ='multiple felonies' -- jailReason is optional, not neededlocal officerPlayerId =2-- officerPlayerId is optional, if used it will be logged in ./jailcp Logsexports['rcore_prison']:Jail(playerId, jailTime, jailReason, officerPlayerId)
Unjail
SERVER
This export is used when you want to unjail citizen which is in Prison.
Example code
server.lua
local playerId =1local skipTeleport =true-- If you dont want to teleport in front of Prisonexports['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.
This export is used when you want to modify target prisoner sentence
Example code
server.lua
local playerId =1local amount =10-- Set target player sentenceexports['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 =1local state = exports['rcore_prison']:IsPrisoner(playerId)if state thenprint('Player is prisoner')elseprint('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 =1local giveAmonunt =500exports['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 =1local removeAmount =500exports['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 =1local sentenceAmount =5-- This is 5 mins by defaultlocal sentenceReason ='Attacked Prison Guard' -- optional, not requredexports['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 =1exports['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 =1local state= exports['rcore_prison']:IsPrisonerInSolitary(playerId)if state thenprint('Prisoner is in solitary cell')end
StartCOMS
SERVER
This export is used when you want to send citizen to Community service
Example code
server.lua
local officerPlayerId = 1 -- If you sent nil instead, the action is not going to logged since initiator is not player but "server"
local targetPlayerid =2-- Target player which should have parollelocal parolleAmount =10-- How many COMS citizen have to do in cyclelocal perollReason ='Abusing' -- Optional (not required)exports['rcore_prison']:StartCOMS(officerPlayerId, targetPlayerId, parolleAmount, perollReason)
JailPlayerByNPC
SERVER
For experienced DEVELOPERS only!
This export is used when you want to jail player by NPC
Example code
server.lua
local targetPlayerId =1local pedId =321321-- The peds needs to be networked to make this -> see: modules\base\server\api\sv-jailPlayer.luaTriggerServerEvent('rcore_prison:server:JailPlayerByNPC', targetPlayerId, PedToNet(pedId))