mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
formatting and typos
This commit is contained in:
1 parent
75698216e0
commit
724c7e356d
99 files changed
+515
-305
No files matched your search
@@ -5,6 +5,7 @@ Should be used alongside [CanCarryItem](./CanCarryItem.md) otherwise, the maximu
|
||||
```lua
|
||||
exports.ox_inventory:AddItem(inv, item, count, metadata, slot, cb)
|
||||
```
|
||||
|
||||
- inv: `table` or `string` or `number`
|
||||
- The inventory's unique id, or a table with the id and owner.
|
||||
- playerId: `1`
|
||||
|
||||
@@ -3,6 +3,7 @@ Returns the amount a player can hold based on available weight.
|
||||
```lua
|
||||
exports.ox_inventory:CanCarryAmount(inv, item)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* item: `table` or `string`
|
||||
* Can be array to check multiple items.
|
||||
|
||||
@@ -5,6 +5,7 @@ The function checks for inventory weight and available slots.
|
||||
```lua
|
||||
exports.ox_inventory:CanCarryItem(inv, item, count, metadata)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* item `table` or `string`
|
||||
* Can be array of items.
|
||||
@@ -13,6 +14,7 @@ exports.ox_inventory:CanCarryItem(inv, item, count, metadata)
|
||||
* If metadata is passed as string then `metadata.type` will be checked.
|
||||
|
||||
**Example:**
|
||||
|
||||
```lua
|
||||
-- Checks if the player calling the event can carry 3 water items
|
||||
if exports.ox_inventory:CanCarryItem(source, 'water', 3) then
|
||||
|
||||
@@ -3,6 +3,7 @@ Returns if inventory can carry specified weight and free inventory weight.
|
||||
```lua
|
||||
exports.ox_inventory:CanCarryWeight(inv, weight)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* weight: `number`
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Returns true if the item swap is possible based on inventory weight.
|
||||
```lua
|
||||
exports.ox_inventory:CanSwapItem(inv, firstItem, firstItemCount, testItem, testItemCount)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* firstItem: `string`
|
||||
* firstItemCount: `number`
|
||||
|
||||
@@ -3,5 +3,6 @@ Clears the specified inventory. The `keep` argument is either a string or an arr
|
||||
```lua
|
||||
exports.ox_inventory:ClearInventory(inv, keep)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* keep?: `string` or `string[]`
|
||||
@@ -6,4 +6,5 @@ the player.
|
||||
```lua
|
||||
exports.ox_inventory:ConfiscateInventory(source)
|
||||
```
|
||||
|
||||
* source: `number`
|
||||
@@ -3,11 +3,14 @@ Takes traditional item data and updates it to support ox_inventory.
|
||||
```lua
|
||||
exports.ox_inventory:ConvertItems(playerId, items)
|
||||
```
|
||||
|
||||
* playerId: `number`
|
||||
* items: `table`
|
||||
|
||||
Data conversion example:
|
||||
```
|
||||
Old: [{"cola":1, "bread":3}]
|
||||
New: [{"slot":1,"name":"cola","count":1}, {"slot":2,"name":"bread","count":3}]
|
||||
|
||||
```lua
|
||||
Old: [{"cola":1, "bread":3}]
|
||||
New: [{"slot":1,"name":"cola","count":1},
|
||||
{"slot":2,"name":"bread","count":3}]
|
||||
```
|
||||
@@ -3,6 +3,7 @@ Drops can be created from other resources, containing a variety of items and uti
|
||||
```lua
|
||||
exports.ox_inventory:CustomDrop(prefix, items, coords, slots, maxWeight, instance)
|
||||
```
|
||||
|
||||
* prefix: `string`
|
||||
* items: `table`
|
||||
* name: `string`
|
||||
|
||||
@@ -4,4 +4,5 @@ Returns the player's currently equipped weapon as a table.
|
||||
-- inv: string or number
|
||||
exports.ox_inventory:GetCurrentWeapon(inv)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
@@ -3,23 +3,25 @@ Returns the inventory associated with the ID (and owner if defined). Otherwise r
|
||||
```lua
|
||||
exports.ox_inventory:GetInventory(inv, owner)
|
||||
```
|
||||
|
||||
* inv: `number` or `table`
|
||||
* owner?: `string` or `boolean`
|
||||
|
||||
**Example:**
|
||||
|
||||
```lua
|
||||
local inventory = exports.ox_inventory:GetInventory('example_stash', false)
|
||||
print(json.encode(inventory, {indent = true}))
|
||||
--[[
|
||||
{
|
||||
"id": "example_stash,
|
||||
"label": "Police Stash",
|
||||
"type": "stash,
|
||||
"slots": 50,
|
||||
"weight": 0,
|
||||
"maxWeight": 100000,
|
||||
"owner": false,
|
||||
...
|
||||
"id": "example_stash,
|
||||
"label": "Police Stash",
|
||||
"type": "stash,
|
||||
"slots": 50,
|
||||
"weight": 0,
|
||||
"maxWeight": 100000,
|
||||
"owner": false,
|
||||
...
|
||||
}
|
||||
]]
|
||||
```
|
||||
@@ -3,10 +3,12 @@ Returns all slots with items in a inventory.
|
||||
```lua
|
||||
exports.ox_inventory:GetInventoryItems(inv, owner)
|
||||
```
|
||||
|
||||
* inv: `number` or `table`
|
||||
* owner?: `string` or `boolean`
|
||||
|
||||
**Example:**
|
||||
|
||||
```lua
|
||||
local playerItems = exports.ox_inventory:GetInventoryItems(source)
|
||||
```
|
||||
@@ -3,6 +3,7 @@ Returns the item from the specified inventory.
|
||||
```lua
|
||||
exports.ox_inventory:GetItem(inv, item, metadata, returnsCount)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* item: `table` or `string`
|
||||
* Can be items array.
|
||||
@@ -15,6 +16,7 @@ how many times the item was found.
|
||||
Otherwise returns the data related to the item _and_ it's total count found in the inventory.
|
||||
|
||||
**Example**:
|
||||
|
||||
```lua
|
||||
local item = ox_inventory:GetItem(source, 'water', nil, false)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Returns the number of slots the specified item is in, the item's total count and
|
||||
```lua
|
||||
exports.ox_inventory:GetItemSlots(inv, item, metadata)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* item: `table` or `string`
|
||||
* metadata?: `table`
|
||||
@@ -4,24 +4,26 @@ Returns the specified slot data as a table.
|
||||
|
||||
exports.ox_inventory:GetSlot(inv, slot)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* slot: `number`
|
||||
|
||||
**Example:**
|
||||
|
||||
```lua
|
||||
local slot = exports.ox_inventory:GetSlot(source, 1)
|
||||
|
||||
print(json.encode(slot, {indent=true}))
|
||||
--[[
|
||||
{
|
||||
"weight": 2000,
|
||||
"name": "water",
|
||||
"metadata": [],
|
||||
"slot": 1,
|
||||
"label": "Water",
|
||||
"close": true,
|
||||
"stack": true,
|
||||
"count: 4
|
||||
"weight": 2000,
|
||||
"name": "water",
|
||||
"metadata": [],
|
||||
"slot": 1,
|
||||
"label": "Water",
|
||||
"close": true,
|
||||
"stack": true,
|
||||
"count: 4
|
||||
}
|
||||
]]
|
||||
```
|
||||
@@ -3,6 +3,7 @@ Creates a new custom stash.
|
||||
```lua
|
||||
exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, coords)
|
||||
```
|
||||
|
||||
* id: `string` or `number`
|
||||
* Stash identifier when loading from the database.
|
||||
* label: `string`
|
||||
@@ -14,9 +15,9 @@ exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, c
|
||||
* `true`: Each player has a unique stash but can request other player's stashes.
|
||||
* `nil`: Always shared.
|
||||
* groups: `table`
|
||||
* Table of player groups (jobs) able to access the stash.
|
||||
* Table of group names where the numeric value is the minimum grade required.
|
||||
* `{['police'] = 0, ['ambulance'] = 2}`
|
||||
* Table of player groups (jobs) able to access the stash.
|
||||
* Table of group names where the numeric value is the minimum grade required.
|
||||
* `{['police'] = 0, ['ambulance'] = 2}`
|
||||
* coords: `vector3`
|
||||
|
||||
:::caution
|
||||
|
||||
@@ -5,4 +5,5 @@ Use it alongside [ConfiscateInventory](./ConfiscateInventory.md).
|
||||
```lua
|
||||
exports.ox_inventory:ReturnInventory(source)
|
||||
```
|
||||
|
||||
* source: `number`
|
||||
@@ -1,9 +1,9 @@
|
||||
Searches an inventory for a specified item.
|
||||
|
||||
```lua
|
||||
|
||||
exports.ox_inventory:Search(inv, search, item, metadata)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* search: `string`
|
||||
* item: `table` or `string`
|
||||
|
||||
@@ -5,11 +5,13 @@ Can be used for repairing weapons.
|
||||
```lua
|
||||
exports.ox_inventory:SetDurability(inv, slot, durability)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* slot: `number`
|
||||
* durability: `number`
|
||||
|
||||
**Example:**
|
||||
|
||||
```lua
|
||||
local ox_inventory = exports.ox_inventory
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ Sets metadata on the specified slot.
|
||||
```lua
|
||||
ox_inventory:SetMetadata(inv, slot, metadata)
|
||||
```
|
||||
|
||||
* inv: `string` or `number`
|
||||
* slot: `number`
|
||||
* metadata: `table`
|
||||
|
||||
**Example:**
|
||||
|
||||
```lua
|
||||
local ox_inventory = exports.ox_inventory
|
||||
|
||||
@@ -18,6 +20,7 @@ for k, v in pairs(water) do
|
||||
water = v
|
||||
break
|
||||
end
|
||||
|
||||
water.metadata.type = 'clean'
|
||||
ox_inventory:SetMetadata(source, water.slot, water.metadata)
|
||||
print(('modified %sx water in slot %s with new metadata'):format(water.count, water.slot))
|
||||
|
||||
@@ -3,6 +3,7 @@ Swaps slots in specified inventories.
|
||||
```lua
|
||||
exports.ox_inventory:SwapSlots(fromInventory, toInventory, slot1, slot2)
|
||||
```
|
||||
|
||||
* fromInventory: `any`
|
||||
* toInventory: `any`
|
||||
* slot1: `number`
|
||||
|
||||
Reference in new issue
Block a user