State Bags

Global and player state used by Possible Turfs.

Important

The resource folder on your server must be named exactly possible_turfs.

Quick reference

State bagScopeTypeSet byDescription
turf:{zoneName}GlobaltableServerOwnership, bomb, cooldown timers
inTurfZonePlayerstring / nilClientCurrent turf zone name
canEmotePlayerbooleanClientEmotes allowed (false inside a turf)

turf:{zoneName}

Example key: turf:Kortz Center

PropertyTypeDescription
isBombPlantedbooleanBomb currently active
plantingGangstring / nilGang that planted
explodedbooleanBomb has exploded
ownerstring / nilOwning gang
bombExpiresAtnumber / nilUnix time bomb detonates
cooldownExpiresAtnumber / nilUnix time cooldown ends
Lua
local state = GlobalState['turf:Kortz Center']if state then    print(state.owner, state.isBombPlanted, state.bombExpiresAt)end
AddStateBagChangeHandler('turf:Kortz Center', 'global', function(bagName, key, value)    if value then        print('Turf updated', value.owner, value.isBombPlanted)    endend)

For a ready-made status table (including remaining seconds), use the exports.

inTurfZone

Set to the zone name on enter, cleared to nil on exit.

Lua
local zone = LocalPlayer.state.inTurfZoneif zone then    print('In turf:', zone)end

canEmote

Set to false when entering a turf, true when leaving. Use this if your emote menu should block in red zones.

Lua
if LocalPlayer.state.canEmote == false then    return -- blockedend
JDB-NET Logo
Partner Service

Self-hosted unlimited logs with managed Grafana

JDB-NET provides a self-hosted solution with unlimited logs, a fully managed Grafana instance, and unlimited users. Perfect for FiveM servers that need comprehensive logging and monitoring.

Check out JDB-NET