From 22edfded40a1176a1d7f276b5275f9b896f6082e Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sat, 6 May 2023 22:59:48 +1000 Subject: [PATCH] new exports and convar --- .../Functions/Server/Inventory/GetItem.md | 5 +++-- .../Functions/Server/Inventory/GetItemCount.md | 13 +++++++++++++ .../Functions/Server/Inventory/GetSlotIdWithItem.md | 13 +++++++++++++ .../Server/Inventory/GetSlotIdsWithItem.md | 13 +++++++++++++ .../Functions/Server/Inventory/GetSlotWithItem.md | 13 +++++++++++++ .../Functions/Server/Inventory/GetSlotsWithItem.md | 13 +++++++++++++ .../Functions/Server/Inventory/RegisterStash.md | 2 +- docs/ox_inventory/Getting Started/config.md | 5 ++++- 8 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 docs/ox_inventory/Functions/Server/Inventory/GetItemCount.md create mode 100644 docs/ox_inventory/Functions/Server/Inventory/GetSlotIdWithItem.md create mode 100644 docs/ox_inventory/Functions/Server/Inventory/GetSlotIdsWithItem.md create mode 100644 docs/ox_inventory/Functions/Server/Inventory/GetSlotWithItem.md create mode 100644 docs/ox_inventory/Functions/Server/Inventory/GetSlotsWithItem.md diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetItem.md b/docs/ox_inventory/Functions/Server/Inventory/GetItem.md index fa6e9439..00f5493f 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/GetItem.md +++ b/docs/ox_inventory/Functions/Server/Inventory/GetItem.md @@ -1,4 +1,4 @@ -Returns the item from the specified inventory. +Returns _generic_ item data from the specified inventory, with the total count. ```lua exports.ox_inventory:GetItem(inv, item, metadata, returnsCount) @@ -8,12 +8,13 @@ exports.ox_inventory:GetItem(inv, item, metadata, returnsCount) * item: `table` or `string` * Can be items array. * metadata?: `any` + * Only returns the count of items that strictly match the given metadata. * returnsCount?: `boolean` If `returnsCount` is set to true, the returned value will be the `count` based on how many times the item was found. -Otherwise returns the data related to the item _and_ it's total count found in the inventory. +Otherwise returns the data related to the item _and_ its total count found in the inventory. **Example**: diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetItemCount.md b/docs/ox_inventory/Functions/Server/Inventory/GetItemCount.md new file mode 100644 index 00000000..c97393bf --- /dev/null +++ b/docs/ox_inventory/Functions/Server/Inventory/GetItemCount.md @@ -0,0 +1,13 @@ +Get the total item count for all items in an inventory with the given name and metadata. + +```lua +exports.ox_inventory:GetItemCount(inv, itemName, metadata, strict) +``` + +- inv: `table` or `string` or `number` +- itemName: `string` +- metadata?: `table` +- strict?: `boolean` + - Strictly match metadata properties, otherwise use partial matching. + +**Returns:** `number?` diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetSlotIdWithItem.md b/docs/ox_inventory/Functions/Server/Inventory/GetSlotIdWithItem.md new file mode 100644 index 00000000..ce0cb404 --- /dev/null +++ b/docs/ox_inventory/Functions/Server/Inventory/GetSlotIdWithItem.md @@ -0,0 +1,13 @@ +Get a slot id in an inventory matching the given name and metadata. + +```lua +exports.ox_inventory:GetSlotIdWithItem(inv, itemName, metadata, strict) +``` + +- inv: `table` or `string` or `number` +- itemName: `string` +- metadata?: `table` +- strict?: `boolean` + - Strictly match metadata properties, otherwise use partial matching. + +**Returns:** `number?` diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetSlotIdsWithItem.md b/docs/ox_inventory/Functions/Server/Inventory/GetSlotIdsWithItem.md new file mode 100644 index 00000000..f77878cd --- /dev/null +++ b/docs/ox_inventory/Functions/Server/Inventory/GetSlotIdsWithItem.md @@ -0,0 +1,13 @@ +Get all slot ids in an inventory matching the given name and metadata. + +```lua +exports.ox_inventory:GetSlotIdsWithItem(inv, itemName, metadata, strict) +``` + +- inv: `table` or `string` or `number` +- itemName: `string` +- metadata?: `table` +- strict?: `boolean` + - Strictly match metadata properties, otherwise use partial matching. + +**Returns:** `number[]?` diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetSlotWithItem.md b/docs/ox_inventory/Functions/Server/Inventory/GetSlotWithItem.md new file mode 100644 index 00000000..cf0628a7 --- /dev/null +++ b/docs/ox_inventory/Functions/Server/Inventory/GetSlotWithItem.md @@ -0,0 +1,13 @@ +Get data for a slot in an inventory matching the given name and metadata. + +```lua +exports.ox_inventory:GetSlotWithItem(inv, itemName, metadata, strict) +``` + +- inv: `table` or `string` or `number` +- itemName: `string` +- metadata?: `table` +- strict?: `boolean` + - Strictly match metadata properties, otherwise use partial matching. + +**Returns:** `table?` diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetSlotsWithItem.md b/docs/ox_inventory/Functions/Server/Inventory/GetSlotsWithItem.md new file mode 100644 index 00000000..812f87c2 --- /dev/null +++ b/docs/ox_inventory/Functions/Server/Inventory/GetSlotsWithItem.md @@ -0,0 +1,13 @@ +Get data all slots in an inventory matching the given name and metadata. + +```lua +exports.ox_inventory:GetSlotsWithItem(inv, itemName, metadata, strict) +``` + +- inv: `table` or `string` or `number` +- itemName: `string` +- metadata?: `table` +- strict?: `boolean` + - Strictly match metadata properties, otherwise use partial matching. + +**Returns:** `table[]?` diff --git a/docs/ox_inventory/Functions/Server/Inventory/RegisterStash.md b/docs/ox_inventory/Functions/Server/Inventory/RegisterStash.md index 8ccbddbf..25ef8ef6 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/RegisterStash.md +++ b/docs/ox_inventory/Functions/Server/Inventory/RegisterStash.md @@ -18,7 +18,7 @@ exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, c * 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` +* coords?: `vector3` or `vector3[]` :::caution diff --git a/docs/ox_inventory/Getting Started/config.md b/docs/ox_inventory/Getting Started/config.md index bf145410..4a12f0d6 100644 --- a/docs/ox_inventory/Getting Started/config.md +++ b/docs/ox_inventory/Getting Started/config.md @@ -53,7 +53,7 @@ setr inventory:enablekeys [249] setr inventory:aimedfiring false # Show a list of all nearby players when giving items -setr inventory:giveplayerlist true +setr inventory:giveplayerlist false # Toggle weapon draw/holster animations setr inventory:weaponanims true @@ -64,6 +64,9 @@ setr inventory:itemnotify true # Disable drop markers and spawn a prop instead setr inventory:dropprops true +# Set the default model used for drop props +setr inventory:dropmodel "prop_med_bag_01b" + # Disarm the player if an unexpected weapon is in use (i.e. did not use the weapon item) setr inventory:weaponmismatch true