Stashes
Owners define stashes inconfig/inventory.lua. Resources add their own at runtime.
config/inventory.lua
Any listed job, gang or group gives access. A stash without any is open to everyone in range.
RegisterStash
check, a function fun(source): boolean that MUST also pass. Registered stashes are removed when your resource stops. Their items stay saved.
GetStash / GetStashId
GetStashId needs the player for personal stashes, to know the character.
Vehicles
Every vehicle has a trunk and a glovebox, keyed by its plate. Sizes come fromtrunk and glovebox in config/inventory.lua.
- Trunk: the player stands within 4 meters and the doors are unlocked.
- Glovebox: the player sits in the vehicle.
- Both are checked on the server, from the vehicle entity and its plate.
SetPersistent
_: ' ab 123 ' is trunk:AB_123.
Drops
Ground drops hold items at a position. They are never saved: a drop disappears when it is empty, or afterlifetime minutes from drops in config/inventory.lua, with its items.
- Players drop items with the client function
Drop. A drop within 1.5 meters with room is reused. - Positions replicate to clients for drawing. Contents are only sent when a player opens a drop within 2.5 meters.
CreateDrop
GetDrops
Opening
A player has their own inventory,player, and at most one more open, other. Opening another closes the previous one.
Reach is checked when it opens, and again on every action: walking away, losing a job or a locked trunk closes it. The client gets ug-core:InventoryClosed.
Open
Inventory:BeforeOpen MAY cancel.
Close / GetOpen
Load
player:12. It unloads again when idle.