diff --git a/pages/ox_inventory/Functions/Server.mdx b/pages/ox_inventory/Functions/Server.mdx index e4b0aed5..96a74259 100644 --- a/pages/ox_inventory/Functions/Server.mdx +++ b/pages/ox_inventory/Functions/Server.mdx @@ -1,19 +1,6 @@ import { Tabs, Tab } from 'nextra-theme-docs'; import { Callout } from 'nextra/components'; -```lua -local itemNames -ESX.RegisterServerCallback('crafting:itemNames', function(source, cb) - if not itemNames then - itemNames = {} - for item, data in pairs(exports.ox_inventory:Items()) do - itemNames[item] = data.label - end - end - cb(itemNames) -end) -``` - ## setPlayerInventory Creates and sets the player's inventory. @@ -114,6 +101,19 @@ exports.ox_inventory:Items() The following snippet can be used in crafting resources such as okokCrafting or core_crafting, rather than querying the database. +```lua +local itemNames +ESX.RegisterServerCallback('crafting:itemNames', function(source, cb) + if not itemNames then + itemNames = {} + for item, data in pairs(exports.ox_inventory:Items()) do + itemNames[item] = data.label + end + end + cb(itemNames) +end) +``` + ## AddItem Adds an item into the specified inventory. @@ -713,8 +713,6 @@ For a use case example on this function check out the written [Guide](../../../G ## CreateTemporaryStash -# CreateTemporaryStash - Creates a temporary stash which will be removed after some time. ```lua