GetPlayerInventory client side, event fires client now

community_bridge:client:inventory:updateInventory
This commit is contained in:
MrNewb committed 2025-02-05 01:54:55 -05:00
1 parent 651c8ae6df
commit 2a326c4811
14 files changed
+110 -3

No files matched your search

+15 -1
View File
@@ -46,7 +46,21 @@ Framework.GetPlayerJob = function()
end
Framework.GetPlayerInventory = function()
return QBCore.Functions.GetPlayerData().items
local items = {}
local frameworkInv = QBCore.Functions.GetPlayerData().items
for _, v in pairs(frameworkInv) do
table.insert(items, {
name = v.name,
label = v.label,
count = v.amount,
slot = v.slot,
metadata = v.info,
stack = v.unique,
close = v.useable,
weight = v.weight
})
end
return items
end
Framework.GetIsPlayerDead = function()
+2
View File
@@ -240,6 +240,7 @@ end
-- Adds the specified item to the player's inventory.
Framework.AddItem = function(src, item, amount, slot, metadata)
local player = QBCore.Functions.GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.AddItem(item, amount, slot, metadata)
end
@@ -247,6 +248,7 @@ end
-- Removes the specified item from the player's inventory.
Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = QBCore.Functions.GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.RemoveItem(item, amount, slot or nil)
end
+2
View File
@@ -218,6 +218,7 @@ end
-- Adds the specified item to the player's inventory.
Framework.AddItem = function(src, item, amount, slot, metadata)
local player = QBox:GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.AddItem(item, amount, slot, metadata)
end
@@ -225,6 +226,7 @@ end
-- Removes the specified item from the player's inventory.
Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = QBox:GetPlayer(src)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.RemoveItem(item, amount, slot)
end