Skip to main content
Server Part of Inventory.

Stashes

Owners define stashes in config/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

Same fields as the config, plus check, a function fun(source): boolean that MUST also pass. Registered stashes are removed when your resource stops. Their items stay saved.
Config names cannot be registered. A name registered by another resource raises.

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 from trunk 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.
Vehicle inventories are temporary: they leave with the vehicle. A garage resource marks owned vehicles persistent, and their items are saved.

SetPersistent

MUST run in a thread. Starts or stops saving the trunk and glovebox of a plate. Stopping deletes the saved items. Plates are trimmed and upper case, with spaces as _: ' 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 after lifetime 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

Every item MUST fit, or no drop is created.

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

MUST run in a thread. Opens any inventory for a player from server code, such as a house stash, a search or an evidence room. Loads it when needed. Reach is not checked: your code decided. Inventory:BeforeOpen MAY cancel.

Close / GetOpen

Load

MUST run in a thread. Loads a saved inventory by id for server code, such as an offline player’s player:12. It unloads again when idle.