From 14609569d7956352df125ef0e14ba2aa54fd2a46 Mon Sep 17 00:00:00 2001 From: Luke <39926192+LukeWasTakenn@users.noreply.github.com> Date: Fri, 9 Jun 2023 00:11:10 +0200 Subject: [PATCH] fix oddities --- pages/ox_inventory/Functions/Server.mdx | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) 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