mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
new docs
This commit is contained in:
1 parent
3cebaf7fa5
commit
b5eba8423f
229 files changed
+6238
-10690
No files matched your search
@@ -0,0 +1,16 @@
|
||||
---
|
||||
keywords: ['hasitem']
|
||||
---
|
||||
|
||||
Get the total item count for all items in the player's inventory with the given name and metadata.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetItemCount(itemName, metadata, strict)
|
||||
```
|
||||
|
||||
- itemName: `string`
|
||||
- metadata?: `table`
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `number?`
|
||||
@@ -0,0 +1,7 @@
|
||||
Get all items in the player's inventory.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetPlayerItems()
|
||||
```
|
||||
|
||||
**Returns:** `table`
|
||||
@@ -0,0 +1,7 @@
|
||||
Get the maximum carry weight of the player's inventory.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetPlayerMaxWeight()
|
||||
```
|
||||
|
||||
**Returns:** `number`
|
||||
@@ -0,0 +1,7 @@
|
||||
Get the total weight of all items in the player's inventory.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetPlayerWeight()
|
||||
```
|
||||
|
||||
**Returns:** `number`
|
||||
@@ -0,0 +1,12 @@
|
||||
Get a slot id in the player's inventory matching the given name and metadata.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetSlotIdWithItem(itemName, metadata, strict)
|
||||
```
|
||||
|
||||
- itemName: `string`
|
||||
- metadata?: `table`
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `number?`
|
||||
@@ -0,0 +1,12 @@
|
||||
Get all slot ids in the player's inventory matching the given name and metadata.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetSlotIdsWithItem(itemName, metadata, strict)
|
||||
```
|
||||
|
||||
- itemName: `string`
|
||||
- metadata?: `table`
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `number[]?`
|
||||
@@ -0,0 +1,12 @@
|
||||
Get data for a slot in the player's inventory matching the given name and metadata.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetSlotWithItem(itemName, metadata, strict)
|
||||
```
|
||||
|
||||
- itemName: `string`
|
||||
- metadata?: `table`
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `table?`
|
||||
@@ -0,0 +1,12 @@
|
||||
Get data all slots in the player's inventory matching the given name and metadata.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetSlotsWithItem(itemName, metadata, strict)
|
||||
```
|
||||
|
||||
- itemName: `string`
|
||||
- metadata?: `table`
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `table[]?`
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
keywords: ['hasitem']
|
||||
---
|
||||
|
||||
import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
|
||||
Searches the inventory for an item, or list of items, with the result varying based on the first argument.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:Search(search, item, metadata)
|
||||
```
|
||||
|
||||
* search: `'slots'` or `'count'`
|
||||
* `'slots'` returns a table of slots where the item was found at.
|
||||
* `'count'` returns the count of the specified item in player's inventory. If searching for multiple items
|
||||
returns key-value pairs of itemName = count.
|
||||
* item: `table` or `string`
|
||||
* Can be a single item name or array of item names.
|
||||
* metadata?: `table` or `string`
|
||||
* If metadata is provided as a string it will search the item's `metadata.type` property.
|
||||
|
||||
### Count
|
||||
|
||||
<Tabs items={["Single item", "Multiple items"]}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local count = exports.ox_inventory:Search('count', 'water')
|
||||
print('You have '..count.. ' water')
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local inventory = exports.ox_inventory:Search('count', {'meat', 'skin'}, {grade="1"})
|
||||
|
||||
if inventory then
|
||||
for name, count in pairs(inventory) do
|
||||
print('You have '..count..' '..name)
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Slots
|
||||
|
||||
<Tabs items={["Single item", "Multiple items"]}>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local water = exports.ox_inventory:Search('slots', 'water')
|
||||
local count = 0
|
||||
for _, v in pairs(water) do
|
||||
print(v.slot..' contains '..v.count..' water '..json.encode(v.metadata))
|
||||
count = count + v.count
|
||||
end
|
||||
print('You have '..count..' water')
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
local items = exports.ox_inventory:Search('slots', {'meat', 'skin'}, 'deer')
|
||||
|
||||
if items then
|
||||
for name, data in pairs(items) do
|
||||
local count = 0
|
||||
for _, v in pairs(data) do
|
||||
if v.slot then
|
||||
print(v.slot..' contains '..v.count..' '..name..' '..json.encode(v.metadata))
|
||||
count = count + v.count
|
||||
end
|
||||
end
|
||||
print('You have '..count..' '..name)
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
</Tab>
|
||||
</Tabs>
|
||||
Reference in new issue
Block a user