[NEW COMMAND - PLUS] Pickup Item

Pollak

Active Member
Oct 12, 2017
161
51
Hi! I've released a command to pickup all items on the room where this item is the same item the user clicked.
e.g: I have 1000 thrones in the room but i only want remove all thrones (without use the command pickall), so i click 2x on the throne and remove all the thrones that I own..
Any ideia or bug just comment, thanks'! :)
PS: I will not make a tutorial step a step, just share the code so if you understand how add shouldn't be difficult.

Habbo.cs:​
Code:
        public bool PickupItemsStatus = false;

New command (PickupItemsCommand.cs):
Code:
#region
using Plus.HabboHotel.GameClients;
#endregion

namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
    public class PickupItemsCommand : IChatCommand
    {
        public string PermissionRequired => "command_pickup_items";

        public string Parameters => "";

        public string Description => "Remove all determined items you click 2x.";

        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            Session.GetHabbo().PickupItemsStatus = !Session.GetHabbo().PickupItemsStatus;
            Session.SendWhisper(Session.GetHabbo().PickupItemsStatus ? "Enabled! Click 2x on the furniture you want remove. Will be remove all items from the room equals this Item." : "Disabled!", 34);
        }
    }
}

CommandManager.cs:
Code:
            Register("pickupitem", new PickupItemsCommand());
UseFurnitureEvent.cs:
maybe after Room User user...
Code:
#region Pickup Items

            if (Session.GetHabbo().PickupItemsStatus)
            {
                int itemRemove = Item.BaseItem;
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    foreach (Item item in Room.GetRoomItemHandler().GetFloor.Where(item => item.BaseItem == itemRemove && item.UserID == Session.GetHabbo().Id && item != null))
                    {
                        dbClient.RunQuery("UPDATE `items` SET `room_id`='0' WHERE `id`= " + item.Id + " LIMIT 1");

                        Room.GetRoomItemHandler().RemoveFurniture(Session, item.Id);
                    }
               
                Session.GetHabbo().GetInventoryComponent().UpdateItems(true);
                Session.GetHabbo().PickupItemsStatus = !Session.GetHabbo().PickupItemsStatus;
                return;
            }

            #endregion
UseWallItemEvent.cs:
Code:
#region Pickup Items

            if (Session.GetHabbo().PickupItemsStatus)
            {
                int itemRemove = Item.BaseItem;
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    foreach (Item item in Room.GetRoomItemHandler().GetWall.Where(item => item.BaseItem == itemRemove && item.UserID == Session.GetHabbo().Id && item != null))
                    {
                        dbClient.RunQuery("UPDATE `items` SET `room_id`='0' WHERE `id`= " + item.Id + " LIMIT 1");

                        Room.GetRoomItemHandler().RemoveFurniture(Session, item.Id);
                    }
               
                Session.GetHabbo().GetInventoryComponent().UpdateItems(true);
                Session.GetHabbo().PickupItemsStatus = !Session.GetHabbo().PickupItemsStatus;
                return;
            }

            #endregion

Execute this query:
Code:
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES ('command_pickup_items', '1', '0');

Preview:
You must be registered for see images attach


Credits:
Snaiker (Pollak)​
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,199
3,934
This is actually a pretty cool idea. I like it! I can imagine it's quite handy for large builds.

Thanks for the share.
 

deethedev

New Member
Nov 18, 2020
2
1
I tried to actually save my .sln but my client just loads to 100% and loops. I'm not too experienced with #c, any help?
 

Users who are viewing this thread

Top