PlusEMU Faceless Command

Wouto

Posting Freak
FindRetros Moderator
May 31, 2011
750
305
This isn't anything special but I was questioned alot on my hotel about how a user could become Faceless so I coded a command to make them faceless and I thought I would share it with the community, this probably isn't the best way of doing it but it does the job I guess?

Place the code below into ChatCommandHandler.cs (I think thats the file name not 100% sure).
Code:
 #region Faceless
                case "faceless":
                    {
                            string[] figureParts;
                            string[] headParts;

                            figureParts = Session.GetHabbo().Look.Split('.');
                            foreach (string Part in figureParts)
                            {
                                if (Part.StartsWith("hd"))
                                {
                                    headParts = Part.Split('-');

                                    if (!headParts[1].Equals("99999"))
                                        headParts[1] = "99999";
                                    else
                                        break;

                                    string NewHead = "hd-" + headParts[1] + "-" + headParts[2];

                                    Session.GetHabbo().Look = Session.GetHabbo().Look.Replace(Part, NewHead);
                                    break;
                                }
                            }

                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
                            {
                                dbClient.setQuery("UPDATE users SET look =  @Look WHERE username =  @username");
                                dbClient.addParameter("look", Session.GetHabbo().Look);
                                dbClient.addParameter("username", Session.GetHabbo().Username);
                                dbClient.runQuery();
                            }

                            Room Room = Session.GetHabbo().CurrentRoom;

                            if (Room == null)
                                break;

                            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

                            if (User == null)
                                break;
                           
                            #region Messages
                            Session.GetMessageHandler().GetResponse().Init(Outgoing.UpdateUserInformation);
                            Session.GetMessageHandler().GetResponse().AppendInt32(-1);
                            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look);
                            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower());
                            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto);
                            Session.GetMessageHandler().GetResponse().AppendInt32(Session.GetHabbo().AchievementPoints);
                            Session.GetMessageHandler().SendResponse();

                            ServerMessage RoomUpdate = new ServerMessage(Outgoing.UpdateUserInformation);
                            RoomUpdate.AppendInt32(User.VirtualId);
                            RoomUpdate.AppendString(Session.GetHabbo().Look);
                            RoomUpdate.AppendString(Session.GetHabbo().Gender.ToLower());
                            RoomUpdate.AppendString(Session.GetHabbo().Motto);
                            RoomUpdate.AppendInt32(Session.GetHabbo().AchievementPoints);
                            Room.SendMessage(RoomUpdate);
                            #endregion
                            break;
                }
#endregion
 

Users who are viewing this thread

Top