All resources

rsg-prison – Developer Docs#

Dependencies#

rsg-core, rsg-inventory, rsg-character, rsg-target, oxmysql. No ox_lib (removed in 3.3.0).

ox_lib migration (3.3.0)#

Was (ox_lib)Now
@ox_lib/init.lua + lib.locale()@rsg-core/shared/locale.lua, locale() directly (convar rsg:locale)
lib.notify / ox_lib:notifyRSGCore.Functions.Notify / RSGCore:Client:Notify
lib.requestModelRSGCore.Functions.RequestModel
lib.points.newpoints.new via @rsg-core/client/points.lua
lib.zones.polylocal point-in-polygon check (500 ms, only while jailed) using Config.PrisonZone
lib.registerContext guard menutwo rsg-target options on the guard ped (water / bread)
lib.onCache('ped')1 s thread watching PlayerPedId() changes
cache.pedPlayerPedId()
exports.ox_targetexports['rsg-target']

Events#

  • rsg-prison:client:Enter (minutes) – send player to jail
  • rsg-prison:client:freedom – release
  • rsg-prison:client:requestRation ('water'|'bread') – client; forwards to server only while jailed (replaces old rsg-prison:client:menu)
  • rsg-prison:server:requestRation (kind) – server validates jailed state, distance, cooldown and max
  • rsg-prison:server:escapeAttempt – logged, rate-limited server-side

Config#

Config.PrisonZone.points (vec3 list) and thickness (total height band centred on the first point's z).

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-prison 3.3.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, rsg-inventory, rsg-character, rsg-target, oxmysql

Configuration#

OptionDefaultNotes
Config.RemoveJobtrueplayer loses ALL their jobs (rsg-multijob) when jailed and must be re-hired
Config.JailAllowance0cash given when jailed (0 = none)
Config.DistanceSpawn20.0distance the guard npc spawns at
Config.FadeIntruefade the guard npc in / out
Config.ReturnOnEscapetrueteleport prisoners back if they leave the prison zone
Config.GuardRationstable
Config.Bliptable
Config.Locationstable
Config.MenuLocationstableprison guard (menu) locations
Config.PrisonZonetableprison boundary (poly zone; thickness = height around points' z)

Exports#

Server

ExportArgumentsFile
DiscordLogcategory, title, src, fields, descriptionserver/discord.lua
-- example
local result = exports['rsg-prison']:DiscordLog(category, title, src, fields, description)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
rsg-prison:client:updateTimeclientsecs, totalclient/client.lua
rsg-prison:client:disarmclient``client/client.lua
rsg-prison:client:reequipclientweapons, knivesclient/client.lua
rsg-prison:client:requestRationclientkindclient/client.lua
rsg-prison:client:Enterclienttimeclient/client.lua
rsg-prison:client:freedomclient``client/client.lua
RSGCore:Client:OnPlayerLoadedclient``client/client.lua
RSGCore:Client:OnPlayerUnloadclient``client/client.lua
rsg-prison:server:startSentenceserver``server/server.lua
rsg-prison:server:checkReleaseserver``server/server.lua
rsg-prison:server:escapeAttemptserver``server/server.lua
rsg-prison:server:requestRationserverkindserver/server.lua
-- from a client script
TriggerServerEvent('rsg-prison:server:startSentence')
-- from a server script
TriggerClientEvent('rsg-prison:client:updateTime', source, secs, total)

Locales#

Language files in locales/: de, el, en, es, fr, it, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->