Update usable items info and add item events

This commit is contained in:
Linden committed 2022-03-30 09:33:28 +11:00
1 parent 1adceb5820
commit ad88ea4364
3 files changed
+78 -20

No files matched your search

+16 -1
View File
@@ -1,5 +1,20 @@
Returns a table of all registered items.
Returns a table of all registered items. The format is as defined in [https://github.com/overextended/ox_inventory/blob/main/data/items.lua](data/items.lua).
```lua
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)
```