mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
refactor: Add h1 headers to all pages missing it (#137)
* refactor: Add h1 headers to all pages missing it * refactor: missed example h3 * change hooks example heading to bold text --------- Co-authored-by: Luke <[email protected]>
This commit is contained in:
1 parent
74227cc262
commit
1d2c490b26
95 files changed
+2167
-2289
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { Tabs, Tab } from 'nextra-theme-docs';
|
||||
import { Callout } from 'nextra/components';
|
||||
|
||||
# Server
|
||||
|
||||
## setPlayerInventory
|
||||
|
||||
Creates and sets the player's inventory.
|
||||
@@ -40,44 +42,35 @@ exports.ox_inventory:forceOpenInventory(playerId, invType, data)
|
||||
- data: `number` or `string` or `table`
|
||||
|
||||
<Tabs items={["Player", "Stash"]}>
|
||||
<Tab>
|
||||
<Tab>
|
||||
Open the target player's inventory.
|
||||
|
||||
**Open the target player's inventory.**
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'player', 3)
|
||||
```
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'player', 3)
|
||||
```
|
||||
Admin command to open a player's inventory.
|
||||
|
||||
**Admin command to open a player's inventory.**
|
||||
```lua
|
||||
RegisterCommand('openplayerinv', function(source, args)
|
||||
exports.ox_inventory:forceOpenInventory(source, 'player', tonumber(args[1]))
|
||||
end, true)
|
||||
```
|
||||
</Tab>
|
||||
<Tab>
|
||||
|
||||
```lua
|
||||
RegisterCommand('openplayerinv', function(source, args)
|
||||
exports.ox_inventory:forceOpenInventory(source, 'player', tonumber(args[1]))
|
||||
end, true)
|
||||
```
|
||||
Open a custom stash (created on the server with RegisterStash).
|
||||
|
||||
</Tab>
|
||||
<Tab>
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'stash', 'society_police')
|
||||
```
|
||||
|
||||
**Open the first stash in [data/stashes](https://github.com/overextended/ox_inventory/blob/main/data/stashes.lua#L2-L19).**
|
||||
Open a stash with a specific owner.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'stash', 'apartment420')
|
||||
```
|
||||
|
||||
**Open a custom stash (created on the server with RegisterStash).**
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'stash', 'society_police')
|
||||
```
|
||||
|
||||
**Open a stash with a specific owner.**
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'stash', { id = 'police_locker', owner = 'license:xxxxxxxx' })
|
||||
```
|
||||
|
||||
</Tab>
|
||||
```lua
|
||||
exports.ox_inventory:forceOpenInventory(1, 'stash', { id = 'police_locker', owner = 'license:xxxxxxxx' })
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## UpdateVehicle
|
||||
@@ -103,6 +96,7 @@ The following snippet can be used in crafting resources such as okokCrafting or
|
||||
|
||||
```lua
|
||||
local itemNames
|
||||
|
||||
ESX.RegisterServerCallback('crafting:itemNames', function(source, cb)
|
||||
if not itemNames then
|
||||
itemNames = {}
|
||||
@@ -118,7 +112,7 @@ end)
|
||||
|
||||
Adds an item into the specified inventory.
|
||||
|
||||
Should be used alongside [CanCarryItem](./CanCarryItem.md) otherwise, the maximum weight may be exceeded.
|
||||
Should be used alongside [CanCarryItem](#cancarryitem) otherwise, the maximum weight may be exceeded.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:AddItem(inv, item, count, metadata, slot, cb)
|
||||
@@ -143,7 +137,13 @@ If used for glovebox, trunk or stash you must first check the inventory is loade
|
||||
|
||||
Returns `success, response` if cb is undefined, otherwise they are used in the callback only.
|
||||
|
||||
**Example:**
|
||||
**Possible value of the "response" argument, on failure:**
|
||||
|
||||
- "invalid_item": the item doesn't exist
|
||||
- "invalid_inventory": the inventory doesn't exist
|
||||
- "inventory_full": no free slots
|
||||
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local success, response = exports.ox_inventory:AddItem('gloveVGH283', 'bread', 4)
|
||||
@@ -168,12 +168,6 @@ print(json.encode(response, {indent=true}))
|
||||
]]
|
||||
```
|
||||
|
||||
**Possible value of the "response" argument, on failure:**
|
||||
|
||||
- "invalid_item": the item doesn't exist
|
||||
- "invalid_inventory": the inventory doesn't exist
|
||||
- "inventory_full": no free slots
|
||||
|
||||
## RemoveItem
|
||||
|
||||
Removes the specified item from the specified inventory.
|
||||
@@ -205,7 +199,7 @@ Returns success: `boolean`, response: `string?`.
|
||||
- "invalid_inventory": the inventory doesn't exist
|
||||
- "not_enough_items": inventory did not contain enough of the given item
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
-- Removes 2 water from the glovebox for the given plate.
|
||||
@@ -232,7 +226,7 @@ how many times the item was found.
|
||||
|
||||
Otherwise returns the data related to the item _and_ its total count found in the inventory.
|
||||
|
||||
**Example**:
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local item = ox_inventory:GetItem(source, 'water', nil, false)
|
||||
@@ -287,7 +281,7 @@ exports.ox_inventory:CanCarryItem(inv, item, count, metadata)
|
||||
- metadata?: `table` or `string`
|
||||
- If metadata is passed as string then `metadata.type` will be checked.
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
-- Checks if the player calling the event can carry 3 water items
|
||||
@@ -310,7 +304,7 @@ exports.ox_inventory:CanCarryAmount(inv, item)
|
||||
- item: `table` or `string`
|
||||
- Can be array to check multiple items.
|
||||
|
||||
Example:
|
||||
### Example
|
||||
|
||||
```lua
|
||||
-- Checks how much you can carry
|
||||
@@ -359,7 +353,7 @@ exports.ox_inventory:SetMaxWeight(inv, maxWeight)
|
||||
- inv: `table` or `string` or `number`
|
||||
- maxWeight: `number`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local ox_inventory = exports.ox_inventory
|
||||
@@ -396,7 +390,8 @@ exports.ox_inventory:GetItemCount(inv, itemName, metadata, strict)
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `number`
|
||||
Return:
|
||||
- itemCount: `number`
|
||||
|
||||
## GetItemSlots
|
||||
|
||||
@@ -422,7 +417,7 @@ exports.ox_inventory:GetSlot(inv, slot)
|
||||
- inv: `table` or `string` or `number`
|
||||
- slot: `number`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local slot = exports.ox_inventory:GetSlot(source, 1)
|
||||
@@ -454,11 +449,12 @@ exports.ox_inventory:GetSlotForItem(inv, itemName, metadata)
|
||||
- itemName: `string`
|
||||
- metadata: `table?`
|
||||
|
||||
**Returns:** `number?`
|
||||
Return:
|
||||
- slotId: `number?`
|
||||
|
||||
## GetSlotIdWithItem
|
||||
|
||||
Get a slot id in an inventory matching the given name and metadata.
|
||||
Get a slot id in an inventory matching the given item name and metadata.
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:GetSlotIdWithItem(inv, itemName, metadata, strict)
|
||||
@@ -470,7 +466,8 @@ exports.ox_inventory:GetSlotIdWithItem(inv, itemName, metadata, strict)
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `number?`
|
||||
Return:
|
||||
- slotId: `number?`
|
||||
|
||||
## GetSlotIdsWithItem
|
||||
|
||||
@@ -486,7 +483,8 @@ exports.ox_inventory:GetSlotIdsWithItem(inv, itemName, metadata, strict)
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `number[]?`
|
||||
Return:
|
||||
- slotIds: `number[]?`
|
||||
|
||||
## GetSlotWithItem
|
||||
|
||||
@@ -502,7 +500,8 @@ exports.ox_inventory:GetSlotWithItem(inv, itemName, metadata, strict)
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `table?`
|
||||
Return:
|
||||
- slotData: `table?`
|
||||
|
||||
## GetSlotsWithItem
|
||||
|
||||
@@ -518,7 +517,8 @@ exports.ox_inventory:GetSlotsWithItem(inv, itemName, metadata, strict)
|
||||
- strict?: `boolean`
|
||||
- Strictly match metadata properties, otherwise use partial matching.
|
||||
|
||||
**Returns:** `table[]?`
|
||||
Return:
|
||||
- slotsData: `table[]?`
|
||||
|
||||
## GetEmptySlot
|
||||
|
||||
@@ -530,7 +530,8 @@ exports.ox_inventory:GetEmptySlot(inv)
|
||||
|
||||
- inv: `table` or `string` or `number`
|
||||
|
||||
**Returns:** `number?`
|
||||
Return:
|
||||
- slotId: `number?`
|
||||
|
||||
## GetContainerFromSlot
|
||||
|
||||
@@ -543,7 +544,8 @@ exports.ox_inventory:GetContainerFromSlot(inv, slotId)
|
||||
- inv: `table` or `string` or `number`
|
||||
- slotId: `number`
|
||||
|
||||
**Returns:** `table?`
|
||||
Return:
|
||||
- containerData: `table?`
|
||||
|
||||
## SetSlotCount
|
||||
|
||||
@@ -556,7 +558,7 @@ exports.ox_inventory:SetSlotCount(inv, slots)
|
||||
- inv: `table` or `string` or `number`
|
||||
- slots: `number`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local ox_inventory = exports.ox_inventory
|
||||
@@ -576,7 +578,7 @@ exports.ox_inventory:GetInventory(inv, owner)
|
||||
- inv: `number` or `table`
|
||||
- owner?: `string` or `boolean`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local inventory = exports.ox_inventory:GetInventory('example_stash', false)
|
||||
@@ -606,7 +608,7 @@ exports.ox_inventory:GetInventoryItems(inv, owner)
|
||||
- inv: `number` or `table`
|
||||
- owner?: `string` or `boolean`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local playerItems = exports.ox_inventory:GetInventoryItems(source)
|
||||
@@ -616,7 +618,7 @@ local playerItems = exports.ox_inventory:GetInventoryItems(source)
|
||||
|
||||
Clears a player's inventory and saves it to a stash.
|
||||
|
||||
Use [ReturnInventory](./Server/#returninventory) to return the confiscated inventory back to
|
||||
Use [ReturnInventory](#returninventory) to return the confiscated inventory back to
|
||||
the player.
|
||||
|
||||
```lua
|
||||
@@ -629,7 +631,7 @@ exports.ox_inventory:ConfiscateInventory(source)
|
||||
|
||||
Returns the confiscated inventory back to the player.
|
||||
|
||||
Use it alongside [ConfiscateInventory](./Server/#confiscateinventory.md).
|
||||
Use it alongside [ConfiscateInventory](#confiscateinventory).
|
||||
|
||||
```lua
|
||||
exports.ox_inventory:ReturnInventory(source)
|
||||
@@ -702,14 +704,12 @@ exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, c
|
||||
- coords?: `vector3` or `vector3[]`
|
||||
|
||||
<Callout>
|
||||
|
||||
This function needs to be triggered before a player can open the stash.
|
||||
|
||||
This function needs to be triggered before a player can open the stash.
|
||||
</Callout>
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
For a use case example on this function check out the written [Guide](../../../Guides/stashes.md) for it.
|
||||
For a use case example on this function check out the written [Guide](../Guides/stashes) for it.
|
||||
|
||||
## CreateTemporaryStash
|
||||
|
||||
@@ -736,10 +736,9 @@ exports.ox_inventory:CreateTemporaryStash(properties)
|
||||
- An array of tables, containing a sequence of itemName, count, metadata.
|
||||
|
||||
Return:
|
||||
|
||||
- inventoryId: `string`
|
||||
|
||||
**Example**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local mystash = exports.ox_inventory:CreateTemporaryStash({
|
||||
@@ -800,10 +799,9 @@ exports.ox_inventory:CreateDropFromPlayer(playerId)
|
||||
- playerId: `number`
|
||||
|
||||
Return:
|
||||
|
||||
- dropId: `string`
|
||||
|
||||
**Example**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local dropId = exports.ox_inventory:CreateDropFromPlayer(1)
|
||||
@@ -834,7 +832,7 @@ exports.ox_inventory:SetDurability(inv, slot, durability)
|
||||
- slot: `number`
|
||||
- durability: `number`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local ox_inventory = exports.ox_inventory
|
||||
@@ -862,7 +860,7 @@ ox_inventory:SetMetadata(inv, slot, metadata)
|
||||
- slot: `number`
|
||||
- metadata: `table`
|
||||
|
||||
**Example:**
|
||||
### Example
|
||||
|
||||
```lua
|
||||
local ox_inventory = exports.ox_inventory
|
||||
|
||||
Reference in new issue
Block a user