Filter system plusemu

MasterJiq

Member
Jul 8, 2016
385
23
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
 
May 1, 2015
470
154
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.
 
May 1, 2015
470
154
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;
                }
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
434
647
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;
                }
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)

8901bc2f19b745dca86d3363eb059b9d.png
 

Jerry

not rly active lol
Jul 8, 2013
1,957
522
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)

8901bc2f19b745dca86d3363eb059b9d.png
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.
d42728f1814945c9a03a81bca160a701.png
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
434
647
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.
d42728f1814945c9a03a81bca160a701.png
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

not rly active lol
Jul 8, 2013
1,957
522
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
Noted. Thanks for letting me know.
 

Meap

Don't need glasses if you C#
Nov 7, 2010
1,045
296
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
 

Outlandish

New Member
Feb 4, 2017
1
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
 

MasterJiq

Member
Jul 8, 2016
385
23
Yes I am working on my own, just following some of their codes, not all.
 
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)

8901bc2f19b745dca86d3363eb059b9d.png
I don't think Session.GetHabbo().GetChat().GetAllToString() is valid arguments
 

lStickerz

New Member
Jan 15, 2016
2
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
PSLSXKO.jpg
 

Users who are viewing this thread

Top