Introduction
Statebags
Replicated player state bags exposed by One Inventory.
One Inventory replicates a handful of values onto Player(src).state / LocalPlayer.state so other resources (qb-target, qb-doorlock, custom scripts, ...) can read them without coupling to our exports. All values are replicated to every client.
-- Server
local isBusy = Player(src).state.inv_busy
-- Client
if LocalPlayer.state.inv_busy then return end
Always truthy-check
inv_busy (if state.inv_busy then), never compare with == true. Its value is the registering resource's name, an ownership marker so we never clear a flag another script set.Bags
inv_busy
string | boolean
Truthy while an inventory action is running: item use, hotbar use, ammo load, and similar. Other scripts can set it truthy themselves to block item use and inventory opening, for example while a minigame is running.
inv_open
boolean
true while the inventory UI is open.inv_hotkeys
boolean
true when the inventory hotbar (1-5) keybinds are active. false while the inventory is open or the player is dead.weapons_allowed
boolean
true when weapon-related inputs should be honoured. false while the inventory is open, the player is dead, or the player is cuffed.instance
number | string
Current inventory routing bucket. Used so two players in different instances cannot interact across them.
