itembox started
This commit is contained in:
1 parent
19a17e33bb
commit
d8d3c290f5
2 files changed
+36
-3
No files matched your search
@@ -22,4 +22,16 @@ Inventory.GetItemBySlot = function(src, slot)
|
|||||||
local slotData = sloth:GetItemBySlot(src, slot)
|
local slotData = sloth:GetItemBySlot(src, slot)
|
||||||
if not slotData then return {} end
|
if not slotData then return {} end
|
||||||
return {name = slotData.name, label = slotData.name, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description}
|
return {name = slotData.name, label = slotData.name, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.AddItem = function(src, item, amount, slot, metadata)
|
||||||
|
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add')
|
||||||
|
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
|
||||||
|
return exports['ps-inventory']:AddItem(src, item, amount, slot, metadata, 'community_bridge')
|
||||||
|
end
|
||||||
|
|
||||||
|
Inventory.RemoveItem = function(src, item, amount, slot, metadata)
|
||||||
|
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove')
|
||||||
|
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
|
||||||
|
return exports['ps-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge')
|
||||||
|
end
|
||||||
@@ -4,6 +4,15 @@ local qbInventory = exports['qb-inventory']
|
|||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
|
|
||||||
|
local function getInventoryNewVersion()
|
||||||
|
local version = GetResourceMetadata("qb-inventory", "version", 0)
|
||||||
|
if version and tonumber(version) < 2.0 then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -18,7 +27,7 @@ Inventory.GetImagePath = function(item)
|
|||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
|
|
||||||
function Inventory.GetItemBySlot(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local slotData = qbInventory:GetItemBySlot(src, slot)
|
local slotData = qbInventory:GetItemBySlot(src, slot)
|
||||||
if not slotData then return {} end
|
if not slotData then return {} end
|
||||||
return {
|
return {
|
||||||
@@ -31,4 +40,16 @@ function Inventory.GetItemBySlot(src, slot)
|
|||||||
stack = slotData.unique,
|
stack = slotData.unique,
|
||||||
description = slotData.description
|
description = slotData.description
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.AddItem = function(src, item, amount, slot, metadata)
|
||||||
|
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add')
|
||||||
|
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
|
||||||
|
return exports['qb-inventory']:AddItem(src, item, amount, slot, metadata, 'community_bridge')
|
||||||
|
end
|
||||||
|
|
||||||
|
Inventory.RemoveItem = function(src, item, amount, slot, metadata)
|
||||||
|
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove')
|
||||||
|
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
|
||||||
|
return exports['qb-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge')
|
||||||
|
end
|
||||||
Reference in new issue
Block a user