Sergio Rosendo
Member
- Joined
- Dec 13, 2015
- Messages
- 45
- Reaction score
- 13
I'm trying to count how many of a certain item the player has in his backpack.
For that I'm using player:getSlotItem(CONST_SLOT_BACKPACK):getItemCountById(item).
The problem is that this function only checks the slots in the bp that it was asked to do so. It dosent check the other containers inside that bp.
Also I couldn't find out what the optional argument subtype = -1 stands for in getItemCountById(itemId[, subtype = -1]). Maybe it would allow the function to also check the other containers inside the bp?
Does anyone know how can I solve this problem? How can I make it do a deep search for total item count?
I guess I can use player:getItemCount and them just check if has one of that item equipped and them lower count by 1. But that would require 9 checks.
For that I'm using player:getSlotItem(CONST_SLOT_BACKPACK):getItemCountById(item).
The problem is that this function only checks the slots in the bp that it was asked to do so. It dosent check the other containers inside that bp.
Also I couldn't find out what the optional argument subtype = -1 stands for in getItemCountById(itemId[, subtype = -1]). Maybe it would allow the function to also check the other containers inside the bp?
Does anyone know how can I solve this problem? How can I make it do a deep search for total item count?
I guess I can use player:getItemCount and them just check if has one of that item equipped and them lower count by 1. But that would require 9 checks.
Last edited: