State Bags
Player state used by Possible Territories.
The resource folder on your server must be named exactly possible-territories.
Territories uses one player/entity state bag to tell other scripts which zone someone is in.
possible_territories_info
Set on the player's ped when they enter a territory zone. Cleared (set to nil) when they leave.
Resource sets this server-side with replication on, so clients can read it as well.
Shape
{ name = "LSIA", -- territory / zone name owner = "ballas", -- owning gang, or nil gangColor = 7 -- blip color for the owner}Read on the server
local ped = GetPlayerPed(playerId)local info = Entity(ped).state.possible_territories_info
if info and info.name then print(info.name, info.owner)endThis is what GetPlayerTerritory uses under the hood.
Read on the client
local info = Entity(PlayerPedId()).state.possible_territories_info-- or, for the local player:-- local info = LocalPlayer.state.possible_territories_info
if info then -- player is inside info.nameendNotes
- Only updated when the player actually enters / exits an ox_lib zone. Standing still outside a zone keeps it
nil. - Do not write this bag yourself unless you know what you are doing — the territories resource owns it.
- Ownership changes while someone is already inside a zone may not refresh until they re-enter. Prefer exports for authoritative territory data when you need owner/influence.
