Using qb-inventory or any rebranded version for inventory item counts from multiple stacks is not working
run a check for multiple items and have split stacks of different values, it will only see the total of the first stack and not the total of the items.
Expected behavior
Expected behavior is to check inventory for 3 items, get total count throughout the entire inventory of all stacks and then if passing the check to remove the items and add a different item in its place.
Actual behavior
item count check fails when attempting check by only seeing the first stack. ie looking for 10 water and 10 bread if the first stack of water is 2 and another is 8 it will only see 2.
Additional context
My context was noticing it in qs-inventory, im aware its not qb or qbs issue but the issue is also present in qb inventory and I have tested this in the most up to date core and inventory. here is the server sided check I was able to print proof from. Additionally a video of it is qs-inventory as an example because the issue happens the same in qb inventory.
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local acetone = Player.Functions.GetItemByName('acetone').amount
local antifreeze = Player.Functions.GetItemByName('antifreeze').amount
local sudo = Player.Functions.GetItemByName('sudo').amount
print('acetone: '..tostring(acetone))
print('antifreeze : '..tostring(antifreeze ))
print('sudo: '..tostring(sudo))
if acetone >= 3 and antifreeze >= 5 and sudo >= 7 then
Player.Functions.RemoveItem('acetone', 3 )
Player.Functions.RemoveItem('antifreeze', 5)
Player.Functions.RemoveItem('sudo', 7)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['acetone'], "remove")
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['antifreeze'], "remove")
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['sudo'], "remove")
TriggerClientEvent("mvrp_cookin:rolling", src)
else
print('item check has passed')
TriggerClientEvent("mvrp_cookin:doesnothaveshit", src)
end
end)```
To be clear I understand a video showing the issue in another inventory isnt "proof" of qb-inventory doing it but I can confirm the issue is present there as well but I did not take a video at the time.
functions impacted are getitembyname().ammount. and hasitem
https://streamable.com/1ifi94
### Last Updated
3 days ago
### Custom Resources
nothing that impacts the inventory, this was tested in a fresh test server with qb-inventory
### Resource Rename
no
Summary
item count of split stacks is not working
Reproduction
Using qb-inventory or any rebranded version for inventory item counts from multiple stacks is not working run a check for multiple items and have split stacks of different values, it will only see the total of the first stack and not the total of the items.
Expected behavior
Expected behavior is to check inventory for 3 items, get total count throughout the entire inventory of all stacks and then if passing the check to remove the items and add a different item in its place.
Actual behavior
item count check fails when attempting check by only seeing the first stack. ie looking for 10 water and 10 bread if the first stack of water is 2 and another is 8 it will only see 2.
Additional context
My context was noticing it in qs-inventory, im aware its not qb or qbs issue but the issue is also present in qb inventory and I have tested this in the most up to date core and inventory. here is the server sided check I was able to print proof from. Additionally a video of it is qs-inventory as an example because the issue happens the same in qb inventory.