Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Check User's Inventory
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Core" data-source="post: 392394" data-attributes="member: 72270"><p>Here is a command which I just wrote now (not tested but logically should work). It will list all items in inventory and tell you how many of each item they have.</p><p></p><p>[code]</p><p>InventoryComponent Inventory = Room?.GetRoomUserManager()?.GetRoomUserByHabbo(Params[0])?.GetClient()?.GetHabbo()?.GetInventoryComponent();</p><p></p><p> if(Inventory == null)</p><p> {</p><p> Session.SendWhisper("User was not found or inventory not initilized.");</p><p> return;</p><p> }</p><p></p><p> Dictionary<ItemData, int> _itemCount = new Dictionary<ItemData, int>();</p><p></p><p> foreach (Item Itm in Inventory.GetItems)</p><p> {</p><p> if (_itemCount.ContainsKey(Itm.Data))</p><p> {</p><p> _itemCount[Itm.Data]++;</p><p> }</p><p> else { _itemCount.Add(Itm.Data, 0); }</p><p> }</p><p></p><p> StringBuilder Message = new StringBuilder();</p><p></p><p> foreach(KeyValuePair<ItemData, int> Itm in _itemCount)</p><p> {</p><p> Message.AppendLine($"[-] {Itm.Key.PublicName} - x{Itm.Value}");</p><p> }</p><p></p><p> Session.SendNotification(Message.ToString());[/code]</p></blockquote><p></p>
[QUOTE="Core, post: 392394, member: 72270"] Here is a command which I just wrote now (not tested but logically should work). It will list all items in inventory and tell you how many of each item they have. [code] InventoryComponent Inventory = Room?.GetRoomUserManager()?.GetRoomUserByHabbo(Params[0])?.GetClient()?.GetHabbo()?.GetInventoryComponent(); if(Inventory == null) { Session.SendWhisper("User was not found or inventory not initilized."); return; } Dictionary<ItemData, int> _itemCount = new Dictionary<ItemData, int>(); foreach (Item Itm in Inventory.GetItems) { if (_itemCount.ContainsKey(Itm.Data)) { _itemCount[Itm.Data]++; } else { _itemCount.Add(Itm.Data, 0); } } StringBuilder Message = new StringBuilder(); foreach(KeyValuePair<ItemData, int> Itm in _itemCount) { Message.AppendLine($"[-] {Itm.Key.PublicName} - x{Itm.Value}"); } Session.SendNotification(Message.ToString());[/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Check User's Inventory
Top