State bags ​
Replicated state, readable from any resource on either side without a call.
Player state ​
| Key | Value | Set |
|---|---|---|
Player(src).state.jailed |
boolean |
While the character is jailed |
Player(src).state.prisonMonthsLeft |
integer |
Months left; 0 when free |
Player(src).state.prisonFacility |
facility id or nil | While jailed |
Player(src).state.prisonWanted |
true or nil |
An escapee who is still wanted (cleared when caught or after Config.Escape.manhunt.wantedHours) |
Player(src).state.prisonWarrant |
true or nil |
An open bail warrant (cleared when booked) |
lua
-- client: no phone, no car keys, no robbery while jailed
if LocalPlayer.state.jailed then return end
-- server: a police radar flags escapees
if Player(src).state.prisonWanted then ... end
Standalone: a character resource may set Player(src).state.npPrisonCharacter to a character id; np_prison then
uses it instead of the FiveM license.
Global state ​
| Key | Value |
|---|---|
GlobalState.npPrisonAlert |
{ [facility] = 'quiet' | 'suspicious' | 'siren' | 'manhunt' } |
GlobalState.npPrisonNpcGuards |
{ [facility] = true } while NPC officers are on duty there (no player guard) |
Framework metadata ​
On qb-core and qbx_core (Config.Compat.qb), the player metadata injail (months left) and
criminalrecord.hasRecord are kept in step, so resources that read them keep working.