export GetInventoryItems standard, add export GetItemBySlot

This commit is contained in:
MrNewb committed 2025-01-31 19:15:33 -05:00
1 parent 1d23d256c0
commit 0c90d659a0
14 files changed
+210 -41

No files matched your search

+20
View File
@@ -67,6 +67,26 @@ Framework.GetPlayerInventory = function(src)
return repackedTable
end
Framework.GetItemBySlot = function(src, slot)
local playerItems = QBCore.Functions.GetPlayer(src).PlayerData.items
local repack = {}
for _, v in pairs(playerItems) do
if v.slot == slot then
return {
name = v.name,
label = v.label,
weight = v.weight,
count = v.amount,
metadata = v.info,
slot = v.slot,
stack = v.unique or false,
description = v.description or "none",
}
end
end
return repack
end
-- Framework.SetMetadata(src, metadata, value)
-- Adds the specified metadata key and number value to the player's data.
Framework.SetPlayerMetadata = function(src, metadata, value)