[SERVICE] - Coding Commands

Status
Not open for further replies.
It's up to the room owner if he wanna use it. What if he wanted to make it a donate room? ;)

Ah yeah ur right ;) thats not such a bad idea then,

Also another handy idea than

:allplace
(all users can place, but not move items in a room)

:FreezeAll
([staff] can make everyone freeze)

:limitrights (users rights go away after they moved or placed X tings)
 
Ah yeah ur right ;) thats not such a bad idea then,

Also another handy idea than

:allplace
(all users can place, but not move items in a room)

:FreezeAll
([staff] can make everyone freeze)

:limitrights (users rights go away after they moved or placed X tings)

:limitrights would be hard to code, lol
 
no it wouldn't im going out tonight ill do them all tomorrow

I hope you don't forget the command ":freerights on/off" or whatever command name you see fitting for a command that allows rights for everyone in the room :-)


Thank you and have a great time!
 
why dont you make some commands like allmoonwalk, everybody in room moonwalks, etc

I hope you don't forget the command ":freerights on/off" or whatever command name you see fitting for a command that allows rights for everyone in the room :-)


Thank you and have a great time!


will do these now :)
Allow Rights!
PHP:
internal void allowrights()
        {
            Room room = this.Session.GetHabbo().CurrentRoom; // Current Room
            string on = this.Params[1]; // On / Off


            if (room.OwnerId == Session.GetHabbo().Id) // if room owner
            {
                if (on == "On")
                {
                    foreach (GameClients.GameClient c in ButterflyEnvironment.GetGame().GetClientManager().clients.Values)
                    {
                        if (c.GetHabbo() != null)
                        {
                            uint pId = c.GetHabbo().Id;
                            RoomUser roomUserByHabbo = room.GetRoomUserManager().GetRoomUserByHabbo(pId);
                            if (c.GetHabbo().Username == Session.GetHabbo().Username)
                            {

                            }
                            else
                            {
                                room.UsersWithRights.Add(pId);

                                using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                                {
                                    adapter.runFastQuery(string.Concat(new object[] { "INSERT INTO room_rights (room_id,user_id) VALUES (", room.RoomId, ",", pId, ")" }));
                                }

                                c.GetMessageHandler().GetResponse().Init(Outgoing.GivePowers);
                                c.GetMessageHandler().GetResponse().AppendInt32(room.RoomId);
                                c.GetMessageHandler().GetResponse().AppendInt32(pId);
                                c.GetMessageHandler().GetResponse().AppendString(roomUserByHabbo.GetClient().GetHabbo().Username);
                                c.GetMessageHandler().SendResponse();
                                ServerMessage message = new ServerMessage(Outgoing.RoomRightsLevel);
                                message.AppendInt32(1);
                                roomUserByHabbo.GetClient().SendMessage(message);
                                roomUserByHabbo.RemoveStatus("flatctrl 0");
                                roomUserByHabbo.AddStatus("flatctrl 1", "");
                                roomUserByHabbo.UpdateNeeded = true;




                            }
                        }
                    }
                }
                else if ((on == "Off"))
                {

                    foreach (GameClients.GameClient i in ButterflyEnvironment.GetGame().GetClientManager().clients.Values)
                    {
                        if (i.GetHabbo() != null)
                        {
                            uint pId = i.GetHabbo().Id;
                            RoomUser roomUserByHabbo = room.GetRoomUserManager().GetRoomUserByHabbo(pId);
                            if (i.GetHabbo().Username == Session.GetHabbo().Username)
                            {

                            }
                            else
                            {
                                room.UsersWithRights.Remove(pId);
                                using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                                {

                                    adapter.runFastQuery(string.Concat(new object[] { "DELETE FROM room_rights WHERE room_id = '", room.RoomId, "' AND user_id = '", pId, "'" }));


                                }

                                i.GetMessageHandler().GetResponse().Init(Outgoing.RemovePowers);
                                i.GetMessageHandler().GetResponse().AppendInt32(room.RoomId);
                                i.GetMessageHandler().GetResponse().AppendInt32(pId);

                                i.GetMessageHandler().SendResponse();
                                ServerMessage message = new ServerMessage(Outgoing.RoomRightsLevel);
                                message.AppendInt32(1);
                                roomUserByHabbo.GetClient().SendMessage(message);
                                roomUserByHabbo.RemoveStatus("flatctrl 1");
                                roomUserByHabbo.AddStatus("flatctrl 0", "");
                                roomUserByHabbo.UpdateNeeded = true;
                            }
                        }
                    }

                }
                else
                {
                    Session.SendNotif("Please Type On or Off");
                }
            }
            else
            {
                Session.SendNotif("Your not the Room Owner");
            }
        }
Moonwalkall
PHP:
   internal void moonwalkall()
        {
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
            
            List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
            foreach (RoomUser user in roomUsers)
            {
                user.moonwalkEnabled = true;
            }

        }
freezeall
PHP:
 internal void freezeall()
        {
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
            int effectId = 12;
            List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
            foreach (RoomUser user in roomUsers)
            {
                if (Session.GetHabbo().Id != user.userID)
                {
                    user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(effectId);
                    user.CanWalk = false;
                }
            }

        }

(any bcstorm edit) dont have my plus emu on this computer to code it for plus cant be to hard to convert :) dont forget to chatcommandregistery and command.ini and commandsregister.ini


Thats all im doing for today :) here you go Droppy and Pro
 
Last edited:
will do these now :)
Allow Rights!
PHP:
internal void allowrights()
        {
            Room room = this.Session.GetHabbo().CurrentRoom; // Current Room
            string on = this.Params[1]; // On / Off


            if (room.OwnerId == Session.GetHabbo().Id) // if room owner
            {
                if (on == "On")
                {
                    foreach (GameClients.GameClient c in ButterflyEnvironment.GetGame().GetClientManager().clients.Values)
                    {
                        if (c.GetHabbo() != null)
                        {
                            uint pId = c.GetHabbo().Id;
                            RoomUser roomUserByHabbo = room.GetRoomUserManager().GetRoomUserByHabbo(pId);
                            if (c.GetHabbo().Username == Session.GetHabbo().Username)
                            {

                            }
                            else
                            {
                                room.UsersWithRights.Add(pId);

                                using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                                {
                                    adapter.runFastQuery(string.Concat(new object[] { "INSERT INTO room_rights (room_id,user_id) VALUES (", room.RoomId, ",", pId, ")" }));
                                }

                                c.GetMessageHandler().GetResponse().Init(Outgoing.GivePowers);
                                c.GetMessageHandler().GetResponse().AppendInt32(room.RoomId);
                                c.GetMessageHandler().GetResponse().AppendInt32(pId);
                                c.GetMessageHandler().GetResponse().AppendString(roomUserByHabbo.GetClient().GetHabbo().Username);
                                c.GetMessageHandler().SendResponse();
                                ServerMessage message = new ServerMessage(Outgoing.RoomRightsLevel);
                                message.AppendInt32(1);
                                roomUserByHabbo.GetClient().SendMessage(message);
                                roomUserByHabbo.RemoveStatus("flatctrl 0");
                                roomUserByHabbo.AddStatus("flatctrl 1", "");
                                roomUserByHabbo.UpdateNeeded = true;




                            }
                        }
                    }
                }
                else if ((on == "Off"))
                {

                    foreach (GameClients.GameClient i in ButterflyEnvironment.GetGame().GetClientManager().clients.Values)
                    {
                        if (i.GetHabbo() != null)
                        {
                            uint pId = i.GetHabbo().Id;
                            RoomUser roomUserByHabbo = room.GetRoomUserManager().GetRoomUserByHabbo(pId);
                            if (i.GetHabbo().Username == Session.GetHabbo().Username)
                            {

                            }
                            else
                            {
                                room.UsersWithRights.Remove(pId);
                                using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
                                {

                                    adapter.runFastQuery(string.Concat(new object[] { "DELETE FROM room_rights WHERE room_id = '", room.RoomId, "' AND user_id = '", pId, "'" }));


                                }

                                i.GetMessageHandler().GetResponse().Init(Outgoing.RemovePowers);
                                i.GetMessageHandler().GetResponse().AppendInt32(room.RoomId);
                                i.GetMessageHandler().GetResponse().AppendInt32(pId);

                                i.GetMessageHandler().SendResponse();
                                ServerMessage message = new ServerMessage(Outgoing.RoomRightsLevel);
                                message.AppendInt32(1);
                                roomUserByHabbo.GetClient().SendMessage(message);
                                roomUserByHabbo.RemoveStatus("flatctrl 1");
                                roomUserByHabbo.AddStatus("flatctrl 0", "");
                                roomUserByHabbo.UpdateNeeded = true;
                            }
                        }
                    }

                }
                else
                {
                    Session.SendNotif("Please Type On or Off");
                }
            }
            else
            {
                Session.SendNotif("Your not the Room Owner");
            }
        }
Moonwalkall
PHP:
   internal void moonwalkall()
        {
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
            
            List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
            foreach (RoomUser user in roomUsers)
            {
                user.moonwalkEnabled = true;
            }

        }
freezeall
PHP:
 internal void freezeall()
        {
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
            int effectId = 12;
            List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
            foreach (RoomUser user in roomUsers)
            {
                if (Session.GetHabbo().Id != user.userID)
                {
                    user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(effectId);
                    user.CanWalk = false;
                }
            }

        }

(any bcstorm edit) dont have my plus emu on this computer to code it for plus cant be to hard to convert :) dont forget to chatcommandregistery and command.ini and commandsregister.ini


Thats all im doing for today :) here you go @Droppy and @Pro

Im getting this error?
Error 1 'Butterfly.HabboHotel.GameClients.GameClientManager.clients' is inaccessible due to its protection level C:\Users\MYPC\Emulator\Butterfly\HabboHotel\Misc\ChatCommandHandler.cs 1261 108 Butterfly
Emulator


EDIT:
FIX:
change
private Dictionary<uint, GameClient> clients = new Dictionary<uint, GameClient>();
to
internal Dictionary<uint, GameClient> clients = new Dictionary<uint, GameClient>();

Is this safe to do?
 
Last edited:
Im getting this error?
Error 1 'Butterfly.HabboHotel.GameClients.GameClientManager.clients' is inaccessible due to its protection level C:\Users\MYPC\Emulator\Butterfly\HabboHotel\Misc\ChatCommandHandler.cs 1261 108 Butterfly

EDIT:
FIX:
change
private Dictionary<uint, GameClient> clients = new Dictionary<uint, GameClient>();
to
internal Dictionary<uint, GameClient> clients = new Dictionary<uint, GameClient>();

Is this safe to do?

I changed it to public :)
 
Because freeze doesn't even work. :P It gives you ice skates and a bunny car if you click enough.

ONT
Freezeall is a :Freeze for everyone so it shouldnt have annytig to do with that i geuss

OFFT
Btw may i ask if you use:
room_model_customs for your roombuilder?
Becouse if i add one there and put the room model on custom the room doesnt load
 
PHP:
 internal void freezeall()
        {
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
            int effectId = 12;
            List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
            foreach (RoomUser user in roomUsers)
            {
                if (Session.GetHabbo().Id == user.userID)
                {
                    user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(effectId);
                    user.CanWalk = false;
                }
            }
 
Yes, that'll be asking if your id is the users id, if so do this.. which it's listing all users in room?
 
ONT
Freezeall is a :Freeze for everyone so it shouldnt have annytig to do with that i geuss

OFFT
Btw may i ask if you use:
room_model_customs for your roombuilder?
Becouse if i add one there and put the room model on custom the room doesnt load
Then idk about the freeze. About the roombuilder, I'll contact you in private.
 
Yes, that'll be asking if your id is the users id, if so do this.. which it's listing all users in room?
PHP:
internal void freezeall()
        {
            Room currentRoom = this.Session.GetHabbo().CurrentRoom;
            int effectId = 12;
            List<RoomUser> roomUsers = currentRoom.GetRoomUserManager().GetRoomUsers();
            foreach (RoomUser user in roomUsers)
            {
                if (Session.GetHabbo().Id != user.userID)
                {
                    
                }
else
{
user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ApplyCustomEffect(effectId);
                    user.CanWalk = false;
}
            }  
}

Working freezeall and doesnt freeze the person making the command :)
 
Status
Not open for further replies.
Back