All server exports and events that script provides for developers.
Unjail
Unjail target user if he is prisoner.
Side: server
Type: export
Usage:
local playerId =1exports['rcore_prison']:Unjail(playerId)-- Note: If you want to unjail user without being teleported in front of prison, useful for other resources that for prison break(s).
exports['rcore_prison']:Unjail(playerId, { skipTeleport =true})
IsPrisoner
Returns true/false if player is prisoner
Side: client
Type: export
Usage:
local playerId =1local state, statusCode = exports.rcore_prison:IsPrisoner(playerId)if state thenprint('User is in prison.')elseprint('User is not prisoner.)end
Jail
Jail target user if he is not prisoner.
Side: server
Type: export
Usage:
local playerId =1-- playerIdlocal jailTime =5-- 5 minuteslocal jailReason ='multiple felonies' -- jailReason is optional, not neededexports['rcore_prison']:Jail(playerId, jailTime, jailReason)
GetPrisonerdata
Returns table of cached user prisoner data, if he is prisoner with statusCode
Side: server
Type: export
Usage:
local playerId =1local data, statusCode = exports.rcore_prison:GetPrisonerData(playerId)--- {--- serverId: int,--- officerName: string,--- owner: string,--- state: string,--- jail_time: float,--- accountId: number,--- prisonerName: string, --- }: tableif data andnext(data) and statusCode =='PLAYER_PRISONER_DATA_EXIST' thenlocal serverId = data.serverId -- Prisoner playerIdlocal officerName = data.officerName -- Who jailed this prisonerlocal state = data.state -- jailType: ['jailed', 'cs]local jail_time = data.jail_time -- jailTimelocal accountId = data.accountId -- Prison account ID if existlocal prisonerName = data.prisonerName -- Prisoner nameend
¨
GetPrisonerAccount
Returns table of cached user prisoner account data if data exist for target user with statusCode response.
You can use this export to modify the prisoner sentence from your script.
Side: server
Type: export
Usage:
local playerId =1-- Target playerlocal sentenceTime =30-- By default this is 30 minutes.local sentenceState, sentenceStatusCode = exports.rcore_prison:EditPrisonerSentence({ serverId = playerId, time = sentenceTime, reduceType = 'total' -- Only add total if you want to override prisoner sentence, remove it if you want to reduce his sentence.
})if sentenceState thenprint('User sentence was updated')end
EditPrisonerAccountCredits
You can use this export to modify the prisoner account credits from your script.
Side: server
Type: export
Usage:
local playerId =1-- Target playerlocal reward = math.random(300, 800) -- The random amount between 300 <-> 800 which user receive on his account if action is type.
local state, statusCode = exports.rcore_prison:EditPrisonerAccountCredits({ serverId = playerId, amount = reward, action ='add' -- ['add', 'remove']})if state thenprint('Prisoner account was updated')end
rcore_prison:prisonerState
Used for monitoring actions inside prison, which are being called to this event.
Side: server
Type: event
Usage:
--- {--- state = string, -- ['jailed, 'cs']--- serverId = number, -- playerId--- charId = number/string, -- Player characterId--- userName = string, -- Player username--- prisoner = {--- name = string, -- Prisoner name (IC)--- prisonerId = number, -- Prisoner unique ID--- jailTime = number, -- Prisoner jail time--- jailReason = string, -- Prisoner jail reason--- cellId = number, -- Prisoner cell ID--- }--- }: tableAddEventHandler('rcore_prison:prisonerState', function(data)local data = datalocal state = data and data.state ornilif state =='released' thenelseif state =='jailed' thenlocal jobName =fetchJobFreeActivities()if jobName then Bridge.Notify(data.serverId, { title =l('WARDEN_TITLE'), subtitle =l('PRISON_TITLE'), description ='There is free job to do [' .. jobName ..']', position ='top', lenght =4000, style = { backgroundColor ='#141517', color ='#909296' } })endendend)