CreatorsServer exports
OpenStash
Last updated on
Opens a stash beside a player's bag, as ox_inventory's forceOpenInventory does.
local res = exports.opx_infinity:OpenStash(source, name, options)Scope write · must be awaited.
Parameters
-
source:
number -
name:
string— a stash listed inconfig/inventory, or one named<your resource>.<name> -
options?:
table- slots?:
integer— 1–200, default 50 (only when the stash is created, and never for a configured stash) - maxWeight?:
integer— grams, default 100 000 (the same) - label?:
string - position?:
{ x, y, z }and bucket?:integer— the player must be in reach of it
- slots?:
-
You decide who may open it (a job, a key, a code); OPX checks the reach when you give a position.
-
A stash listed in
config/inventoryis made at its configured size;slotsandmaxWeightonly size a new stash of your own. An existing stash keeps the size it was made with. -
Never a stash outside your namespace (
stash_namespace): a module's or another resource's storage is not yours to open. A new one counts againstSTASHES.CREATE_CAP(stash_cap).
Returns
integer— the container id
Errors
stash_namespace,stash_cap,too_far,not_ready,dead(the player is down),not_loaded,export.badArgument,export.callerDenied
CreateThread(function()
local pending, why = Open77.exports.call('opx_infinity', 'OpenStash', playerId, 'my_shop.backroom', { label = 'Back room' })
if not pending then return print('not sent: ' .. tostring(why)) end
local res = pending:await()
if not (res and res.ok) then return print('refused: ' .. tostring(res and res.error)) end
print('opened container ' .. res.value)
end)