All client exports and events that script provides for developers.
Jail
Jail target user, only if the initiator of this export is Police officer.
Side: client
Type: export
Usage:
1. Jailing a player if we got closest player.
Logic path: rcore_prison/modules/api/client/cl-jailPlayer.lua - JailPlayerCustom
local playerId = MyServerId
local jailTime = 5 -- Jail for 5 minutes
exports.rcore_prison:Jail(playerId, jailTime)
2. Jailing a player if we dont have closest player, handled by rcore_prison
Logic path: rcore_prison/modules/api/client/cl-jailPlayer.lua - JailClosestPlayer
-- If you dont have any closest player, you can use this event to jail the closest player to you.
exports.rcore_prison:Jail()
Unjail
Unjail target user, only if the initiator of this export is Police officer.
Side: client
Type: export
Usage:
1. Unjailing a player if we got closest player.
Logic path: rcore_prison/modules/api/client/cl-unjailPlayer.lua - UnjailClosestPlayer
local playerId = MyServerId
exports.rcore_prison:Unjail(playerId)
2. Jailing a player if we dont have closest player, handled by rcore_prison
Logic path: rcore_prison/modules/api/client/cl-unjailPlayer.lua - UnjailPlayerCustom
-- If you dont have any closest player, you can use this event to jail the closest player to you.
exports.rcore_prison:Unjail()
IsPrisoner
Returns true/false if player is prisoner
Side: client
Type: export
Usage:
local state = exports.rcore_prison:IsPrisoner()
if state then
print('User is in prison.')
else
print('User is not prisoner.)
end
GetPrisonerData
Returns table of cached user prisoner data, if he is prisoner
Side: client
Type: export
Usage:
--- {
--- serverId: int,
--- officerName: string,
--- owner: string,
--- state: string,
--- jail_time: float,
--- accountId: number,
--- prisonerName: string,
--- }: table
local cachedPrisonerData = exports.rcore_prison:GetPrisonerData()
local serverId = cachedPrisonerData.serverId -- Prisoner playerId
local officerName = cachedPrisonerData.officerName -- Who jailed this prisoner
local state = cachedPrisonerData.state -- jailType: ['jailed', 'cs]
local jail_time = cachedPrisonerData.jail_time -- jailTime
local accountId = cachedPrisonerData.accountId -- Prison account ID if exist
local prisonerName = cachedPrisonerData.prisonerName -- Prisoner name
rcore_prison:hudState
Used for monitoring actions inside prison, which are being called to this event.
Side: client
Type: event
Usage:
-- actionType: string [released, firstSpawn, prolog, electrician, cigar]
-- state: boolean
AddEventHandler('rcore_prison:hudState', function(actionType, state)
if actionType == 'firstSpawn' then
print('user is spawned in prison boi')
elseif actionType == 'released' then
print('released boi from prison')
end
end)