Add examples for openInventory

This commit is contained in:
Linden committed 2022-04-29 16:06:58 +10:00
1 parent cf37929419
commit 8661ee0b10
2 files changed
+48 -33

No files matched your search

@@ -1,30 +0,0 @@
Displays the notification used accross the inventory.
The notifications are built using the [react-hot-teast](https://github.com/timolins/react-hot-toast) library.
```lua
-- data: table
exports.ox_inventory:notify(data)
```
Values for the `data` table:
```lua
-- text: string
-- type: string (optional)
-- 'success'
-- 'info' - default
-- 'error'
-- position: string (optional)
-- 'top-left'
-- 'top-center' - default
-- 'top-right'
-- 'bottom-left'
-- 'bottom-center'
-- 'bottom-right
-- duration: number (optional - default is 4000 ms)
```
**Example:**
```lua
exports.ox_inventory:notify({type = 'Success', text = 'Making pancakes', duration = 2500})
```
@@ -1,11 +1,56 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Opens an inventory using on the passed data.
```lua
-- inv: string
-- data: any
-- invType: string
-- data: number | table
exports.ox_inventory:openInventory(invType, data)
exports.ox_inventory:openInventory('player', 1)
exports.ox_inventory:openInventory('stash', 1)
exports.ox_inventory:openInventory('shop', { type = 'PoliceArmoury', id = 1 })
```
```
<Tabs>
<TabItem value="1" label="Player">
**Open the target player's inventory.**
```lua
exports.ox_inventory:openInventory('player', 3)
```
</TabItem>
<TabItem value="2" label="Shop">
**Open the fourth "General Store" [location](https://github.com/overextended/ox_inventory/blob/main/data/shops.lua#L14).**
```lua
exports.ox_inventory:openInventory('shop', { type = 'General', id = 4 })
```
</TabItem>
<TabItem value="3" label="Stash">
**Open the first stash in [data/stashes](https://github.com/overextended/ox_inventory/blob/main/data/stashes.lua#L2-L19).**
```lua
exports.ox_inventory:openInventory('stash', 1)
```
**Open a custom stash (created on the server with RegisterStash).**
```lua
exports.ox_inventory:openInventory('stash', 'society_police')
```
**Open a stash with a specific owner.**
```lua
exports.ox_inventory:openInventory('stash', { id = 'police_locker', owner = 'license:xxxxxxxx' })
```
</TabItem>
</Tabs>