treebeard
Member
- Jan 16, 2018
- 317
- 173
Hello everyone,
For some reason when using the viewinventory command the first time the command is used it doesn't actually show the other users inventory. It requires the user to use the command a second time to be able to actually see the other persons inventory.
Here is my ViewInventoryCommand.cs
I appreciate your time, energy, and feedback!
For some reason when using the viewinventory command the first time the command is used it doesn't actually show the other users inventory. It requires the user to use the command a second time to be able to actually see the other persons inventory.
Here is my ViewInventoryCommand.cs
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Furni;
namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
class ViewInventoryCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_viewinv"; }
}
public string Parameters
{
get { return "%name%"; }
}
public string Description
{
get { return ""; }
}
public void Execute(GameClient Session, Room Room, string[] Params)
{
if (Session.GetHabbo().ViewInventory)
{
Session.SendPacket(new FurniListComposer(Session.GetHabbo().GetInventoryComponent().GetFloorItems().ToList(), Session.GetHabbo().GetInventoryComponent().GetWallItems()));
Session.GetHabbo().ViewInventory = false;
Session.SendWhisper("Inventory reverted back to your own.");
return;
}
if (Params.Length == 1)
{
Session.SendWhisper("Please enter the username of the user you'd like to check inventory.");
return;
}
GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
if (TargetClient == null)
{
Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
return;
}
if (TargetClient.GetHabbo() == null)
{
Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");
return;
}
Session.SendPacket(new FurniListComposer(TargetClient.GetHabbo().GetInventoryComponent().GetFloorItems().ToList(), TargetClient.GetHabbo().GetInventoryComponent().GetWallItems(), true));
Session.GetHabbo().ViewInventory = true;
Session.SendWhisper("Next time you open your inventory you'll see " + TargetClient.GetHabbo().Username + "'s inventory.");
}
}
}
I appreciate your time, energy, and feedback!