1. Tired of not being able to see links? Want to chat with other members? Need help?

Filter system plusemu

Discussion in 'Habbo Help & Support' started by MasterJiq, Feb 4, 2017.

  1. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    Hello!

    I am trying to make filter word alert like we said ".com" and that word has been filtered, so alert come to the users.
    I am making it on ChatEvent.
    So someone could fix my code, the code seems not working ?
    Code:
    using System;
     
    using Plus.Core;
    using Plus.Communication.Packets.Incoming;
    using Plus.Utilities;
    using Plus.HabboHotel.Global;
    using Plus.HabboHotel.Quests;
    using Plus.HabboHotel.Rooms;
    using Plus.HabboHotel.GameClients;
    using Plus.HabboHotel.Rooms.Chat.Logs;
    using Plus.Communication.Packets.Outgoing.Messenger;
    using Plus.Communication.Packets.Outgoing.Rooms.Chat;
    using Plus.Communication.Packets.Outgoing.Moderation;
    using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
    using Plus.HabboHotel.Rooms.Chat.Styles;
     
    namespace Plus.Communication.Packets.Incoming.Rooms.Chat
    {
        public class ChatEvent : IPacketEvent
        {
            public void Parse(GameClient Session, ClientPacket Packet)
            {
                if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
                    return;
     
                Room Room = Session.GetHabbo().CurrentRoom;
                if (Room == null)
                    return;
     
                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (User == null)
                    return;
     
                string Message = StringCharFilter.Escape(Packet.PopString());
                if (Message.Length > 100)
                    Message = Message.Substring(0, 100);
     
                int Colour = Packet.PopInt();
     
                ChatStyle Style = null;
                if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
                    Colour = 0;
     
                User.UnIdle();
     
                if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime && Session.GetHabbo().FloodTime != 0)
                    return;
     
                if (Session.GetHabbo().TimeMuted > 0)
                {
                    Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                    return;
                }
                if (PlusEnvironment.GetGame().GetChatManager().GetFilter().IsFiltered(Message))
                {
            
                    PlusEnvironment.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Filtered Words Alert",
                                 "Hello <b>" + Session.GetHabbo().Username + "!<br>" +
     
                                 "<br></b> Seems like you've used word that has been filtered" + "<br>" +
     
                                 "<br><b>The filtered words:</b><br>" +
                                   "<br>" + "<b>" + "<font color =\"#FF0000\">" + Message + "</font>" + "</b><br>" +
                                 "<br>Click button below to reload this alert.</b>",
                                 "filter", "Reload", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
                    Session.GetHabbo().GetClient().SendMessage(new WhisperComposer(User.VirtualId, "La siguiente Palabra esta prohibida en el hotel:" + " " + Message, 0, 34));
                    Message = null;
                }
     
                if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
                {
                    Session.SendWhisper("Oops, you're currently muted.");
                    return;
                }
     
                User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;
     
                if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
                {
                    int MuteTime;
                    if (User.IncrementAndCheckFlood(out MuteTime))
                    {
                        Session.SendMessage(new FloodControlComposer(MuteTime));
                        return;
                    }
                }
     
                if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
                    return;
                    
                if (Message.Contains(":amercianpie"))
                {
                    Session.GetHabbo().Effects().ApplyEffect(104);
                }
     
                PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));
     
                if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
                {
                    Session.GetHabbo().BannedPhraseCount++;
     
                    if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
                    {
                        PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
                        Session.Disconnect();
                        return;
                    }
     
                    Session.SendMessage(new ChatComposer(User.VirtualId, Message, 0, Colour));
                    return;
                }
     
                if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
                    Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
     
     
                PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);
     
                User.OnChat(User.LastBubble, Message, false);
                }
              }
            }
    So it is working ? I've tried and not working. lol
     
  2. Core

    Core Member

    Joined:
    Nov 10, 2016
    Messages:
    356
    Likes Received:
    145
    Inside the IsFiltered function
     
  3. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    @Core what do you mean man ?
     
  4. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    @Clif I already pm you. check your inbox. Thanks
     
  5. Altercationz

    Altercationz Developer

    Joined:
    May 1, 2015
    Messages:
    444
    Likes Received:
    164
    I'm not home right now, if you still need help, I'll help you when I get home.
    Just a tip, you should check if the filtered message is bannable, such as a hotel name because people could be saying a URL that has nothing to do with a hotel.
     
  6. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
  7. Altercationz

    Altercationz Developer

    Joined:
    May 1, 2015
    Messages:
    444
    Likes Received:
    164
    Give this a try, it isn't tested but should work.
    Code:
    if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
                {
                    Session.GetHabbo().BannedPhraseCount++;
                    if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
                    {
                        PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
                        Session.Disconnect();
                        return;
                    }
                    else
                    {
                        Session.SendNotification("You have been muted for 5 minutes due to mentioning a banned word.");
                        User.GetClient().GetHabbo().TimeMuted = 5;
                    }
                   
     
  8. Damien

    Damien Don't need glasses if you can C#

    Joined:
    Feb 26, 2012
    Messages:
    322
    Likes Received:
    533
    This is a somewhat similar system to what I have except mine sends a help ticket so the mods can review the users chat (see if it's legit or not)

    [​IMG]
     
    Altercationz likes this.
  9. Jerry

    Jerry holorp.com | revivalrp.us

    Joined:
    Jul 8, 2013
    Messages:
    1,927
    Likes Received:
    529
    Same here, but the system warns the user first for mentioning a filtered hotel name and if a user attempts to mention it again, they'll be muted for an hour.
    [​IMG]
     
    Damien likes this.
  10. Damien

    Damien Don't need glasses if you can C#

    Joined:
    Feb 26, 2012
    Messages:
    322
    Likes Received:
    533
    Looks good, only thing I'd suggest is caching previous messages and sending them as a list (or a string) to the CheckBannedWords method. That way people can't do the dirty and do it on multiple lines.

    Make sure you set a limit to cached messages otherwise you'll have some nasty memory leaks. But I'm sure you already know about that
     
    Jerry likes this.
  11. Jerry

    Jerry holorp.com | revivalrp.us

    Joined:
    Jul 8, 2013
    Messages:
    1,927
    Likes Received:
    529
    Noted. Thanks for letting me know.
     
  12. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    Thankyou all because helping, I will check now. But the image seems hard to I copy haha
     
  13. Meap

    Meap Don't need glasses if you C#

    Joined:
    Nov 7, 2010
    Messages:
    960
    Likes Received:
    290
    Just copying that won't really help you unless you edit the word filter itself otherwise when you filter a word whenever someone says it, it's just gonna mute them and it would be easy to get around
     
  14. Outlandish

    Outlandish New Member

    Joined:
    Feb 4, 2017
    Messages:
    1
    Likes Received:
    0
    I feel as though you have to do a portion of the work yourself it appears that you thoroughly depend on others to take the necessary steps for you despite the fact that others have revealed to you how to settle it or some have even offered to help you settle it
     
  15. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    Yes I am working on my own, just following some of their codes, not all.
    --- Double Post Merged, Feb 4, 2017, Original Post Date: Feb 4, 2017 ---
    I don't think Session.GetHabbo().GetChat().GetAllToString() is valid arguments
     
  16. Damien

    Damien Don't need glasses if you can C#

    Joined:
    Feb 26, 2012
    Messages:
    322
    Likes Received:
    533
    Yeah it's a method I created that's used to grab all the perviously said messages from the user.
     
  17. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    @Damiens @Meap @Jerry_ @Altercationz sorry for go back to this emu, can someone help me I used Staff Alert
    Code:
    " new RoomNotificationComposer('Title', 'text'); "
    but its goes to let all users get the notifications.
     
  18. lStickerz

    lStickerz New Member

    Joined:
    Jan 15, 2016
    Messages:
    2
    Likes Received:
    0
    Try this in the Communication/packets/incoming/rooms/chat/ChatEvent
    pastebin, com/NjUX89R1 (sorry it wasnt letting me to post a link :down:)

    you only gonna need to translate some words that are in spanish

    Result [​IMG]
     
  19. MasterJiq

    MasterJiq Member

    Joined:
    Jul 8, 2016
    Messages:
    370
    Likes Received:
    22
    @Istickerz, fixed already *by my own*
     

Share This Page

Loading...