[NEW COMMANDS] - OPEN ROOM, CLOSE ROOM

Pollak

Active Member
Oct 12, 2017
161
51
Well, I came in wanting the commands to open the room and close the room. I searched the Internet and could not
to find none I wanted. So I decided to create it for myself (probably if someone has these commands, maybe they are almost the same).
I developed the entire command, but I was having trouble trying to put the room icon closed and not having to stay
restarting emulator for this to appear.

GO: HabboHotel>Rooms>Chat>Commands>Administrator and enter a new code with the name OpenRoomCommand.cs​
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Text;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.Core;
using System;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class OpenRoomCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_openroom"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Abre o quarto."; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
                var room = Session.GetHabbo().CurrentRoom;
                room.Access = RoomAccess.OPEN;
                room.RoomData.Access = RoomAccess.OPEN;
                using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    queryReactor.runFastQuery(string.Format("UPDATE rooms SET state = 'open' WHERE id = {0}",
                        room.RoomId));

                Session.SendMessage(new RoomAlertComposer("Quarto aberto com sucesso!"));
                Session.SendWhisper("Comando executado com sucesso!");
            }
        }
    }
}
GO: HabboHotel>Rooms>Chat>Commands>Administrator and enter a new code with the name CloseRoomCommand.cs​
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Text;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.Core;
using System;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class CloseRoomCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_closeroom"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Fecha o quarto."; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
                var room = Session.GetHabbo().CurrentRoom;
                room.Access = RoomAccess.DOORBELL;
                room.RoomData.Access = RoomAccess.DOORBELL;
                using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    queryReactor.runFastQuery(string.Format("UPDATE rooms SET state = 'locked' WHERE id = {0}",
                        room.RoomId));
                
                Session.SendMessage(new RoomAlertComposer("Quarto fechado com sucesso!"));
                Session.SendWhisper("Comando executado com sucesso!");
            }
        }
    }
}
GO: HabboHotel>Rooms>Chat>Commands in CommandManager.cs
Search for private void RegisterAdministrator() and enter:​
Code:
this.Register("openroom", new OpenRoomCommand());
this.Register("closeroom", new CloseRoomCommand());
Then debug everything you entered.
Then go to your database (db) in the permissions_commands table and enter:​
Code:
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES ('command_openroom', '6', '0');
INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES ('command_closeroom', '6', '0');

Credits:
Snaiker (Pollak)
DevBest <3​
 

GarettM

Posting Freak
Aug 5, 2010
833
136
Here is the engwish version for the lazy <3 Google Translater

OpenRoomCommand.cs

Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Text;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.Core;
using System;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class OpenRoomCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_openroom"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Unlocks the current room"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
                var room = Session.GetHabbo().CurrentRoom;
                room.Access = RoomAccess.OPEN;
                room.RoomData.Access = RoomAccess.OPEN;
                using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    queryReactor.runFastQuery(string.Format("UPDATE rooms SET state = 'open' WHERE id = {0}",
                        room.RoomId));

                Session.SendMessage(new RoomAlertComposer("The room has been unlocked successfully!"));
                Session.SendWhisper("The room has been unlocked");
            }
        }
    }
}

CloseRoomCommand.cs
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Text;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.Core;
using System;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class CloseRoomCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_closeroom"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Locks the current room"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
                var room = Session.GetHabbo().CurrentRoom;
                room.Access = RoomAccess.DOORBELL;
                room.RoomData.Access = RoomAccess.DOORBELL;
                using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    queryReactor.runFastQuery(string.Format("UPDATE rooms SET state = 'locked' WHERE id = {0}",
                        room.RoomId));
                
                Session.SendMessage(new RoomAlertComposer("The room has been locked successfully!"));
                Session.SendWhisper("The room has been locked");
            }
        }
    }
}
 

Pollak

Active Member
Oct 12, 2017
161
51
Here is the engwish version for the lazy <3 Google Translater

OpenRoomCommand.cs

Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Text;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.Core;
using System;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class OpenRoomCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_openroom"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Unlocks the current room"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
                var room = Session.GetHabbo().CurrentRoom;
                room.Access = RoomAccess.OPEN;
                room.RoomData.Access = RoomAccess.OPEN;
                using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    queryReactor.runFastQuery(string.Format("UPDATE rooms SET state = 'open' WHERE id = {0}",
                        room.RoomId));

                Session.SendMessage(new RoomAlertComposer("The room has been unlocked successfully!"));
                Session.SendWhisper("The room has been unlocked");
            }
        }
    }
}

CloseRoomCommand.cs
Code:
using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Inventory.Purse;
using System.Text;
using Plus.Communication.Packets.Outgoing.Notifications;
using Plus.Core;
using System;
using Plus.Database.Interfaces;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class CloseRoomCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_closeroom"; }
        }

        public string Parameters
        {
            get { return ""; }
        }

        public string Description
        {
            get { return "Locks the current room"; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
                var room = Session.GetHabbo().CurrentRoom;
                room.Access = RoomAccess.DOORBELL;
                room.RoomData.Access = RoomAccess.DOORBELL;
                using (var queryReactor = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    queryReactor.runFastQuery(string.Format("UPDATE rooms SET state = 'locked' WHERE id = {0}",
                        room.RoomId));
               
                Session.SendMessage(new RoomAlertComposer("The room has been locked successfully!"));
                Session.SendWhisper("The room has been locked");
            }
        }
    }
}
Thank's bro hahahah <3
 

cammy

Member
May 15, 2014
470
220
Really don't see the use in this. It'll take you about 2 seconds longer to just do it the normal way.
Good work tho!
 

Users who are viewing this thread

Top