mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 06:28:54 +00:00
hookId return
This commit is contained in:
1 parent
f60a847c56
commit
f505d9666f
1 file changed
+15
-3
@@ -31,10 +31,14 @@ By returning `false`, you can cancel the action and revert the inventory state.
|
|||||||
- toSlot?: `table` or `number`
|
- toSlot?: `table` or `number`
|
||||||
- count: `number`
|
- count: `number`
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
- hookId: `number`
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
exports.ox_inventory:registerHook('swapItems', function(payload)
|
local hookId = exports.ox_inventory:registerHook('swapItems', function(payload)
|
||||||
print(json.encode(payload, { indent = true }))
|
print(json.encode(payload, { indent = true }))
|
||||||
return false
|
return false
|
||||||
end, {
|
end, {
|
||||||
@@ -59,11 +63,15 @@ Blacklists "water" from being moved into or from gloveboxes and trunks.
|
|||||||
- inventoryId: `number` or `string`
|
- inventoryId: `number` or `string`
|
||||||
- inventoryType: `string`
|
- inventoryType: `string`
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
- hookId: `number`
|
||||||
|
|
||||||
Triggered when a player tries to open a secondary inventory.
|
Triggered when a player tries to open a secondary inventory.
|
||||||
By returning `false`, you can cancel the action and keep the player's inventory closed.
|
By returning `false`, you can cancel the action and keep the player's inventory closed.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
exports.ox_inventory:registerHook('openInventory', function(payload)
|
local hookId = exports.ox_inventory:registerHook('openInventory', function(payload)
|
||||||
print(json.encode(payload, { indent = true }))
|
print(json.encode(payload, { indent = true }))
|
||||||
return false
|
return false
|
||||||
end, {
|
end, {
|
||||||
@@ -86,11 +94,15 @@ Disables gloveboxes and trunks.
|
|||||||
- item: `table`
|
- item: `table`
|
||||||
- count: `number`
|
- count: `number`
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
- hookId: `number`
|
||||||
|
|
||||||
Triggered when an item is created, either by buying it, using AddItem, or when converting inventory data.
|
Triggered when an item is created, either by buying it, using AddItem, or when converting inventory data.
|
||||||
By returning a table you can modify or replace the metadata given to an item.
|
By returning a table you can modify or replace the metadata given to an item.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
exports.ox_inventory:registerHook('createItem', function(payload)
|
local hookId = exports.ox_inventory:registerHook('createItem', function(payload)
|
||||||
print(json.encode(payload, { indent = true }))
|
print(json.encode(payload, { indent = true }))
|
||||||
local metadata = payload.metadata
|
local metadata = payload.metadata
|
||||||
metadata.label = 'Mineral Water'
|
metadata.label = 'Mineral Water'
|
||||||
|
|||||||
Reference in new issue
Block a user