Temporary Inventories
On this page we dive into what "Temporary Inventories" are and what they can be used for.
Last updated
On this page we dive into what "Temporary Inventories" are and what they can be used for.
Last updated
Temporary Inventories are Inventories that are loaded during runtime when needed, and unloaded when no player is accessing the Inventory. For example this can be used for stashes. In this example we are going to make a police storage.
In order to use this, you need to have some experience with coding.
First we need to register a temporary inventory handler using . Temporary inventory handler are the code that is called when the police locker is accessed, in this code you can add checks & load the specific inventory that is needed.
After registering the temporary inventory handler, we can load the inventory by the identifier(If it exists) using .
The third parameter of CreateInventory is 'container', make sure the container is registered in your configs/container.shared.lua. For example:
Now, if the inventory does not exist, we create a new one using .
Now, all the server-side part is done. We are now going to access the inventory on the client-side. Thats quite easy, we only need to make one API call, thats .