[REL] 241 bad words included in .txt and .sql

12/12/2009 21:57 ImmuneOne#1
Hey,

I've been creating a server-side filter in order to keep my server clean, and to not disappoint players who care.

I'm not giving the actual code but atleast gonna give the 241 words.
I have nothing else to say, seeya.

**Server-Side filter
12/13/2009 00:47 nTL3fTy#2
Penis is a medical term. Same goes for vagina. Same goes for various others. But if you feel the need ...
12/13/2009 00:54 ImmuneOne#3
Quote:
Originally Posted by nTL3fTy View Post
Penis is a medical term. Same goes for vagina. Same goes for various others. But if you feel the need ...
There certainly is, medical terms shouldn't belong in a gamechat anyway.
12/13/2009 00:55 zbest#4
Quote:
Originally Posted by ImmuneOne View Post
There certainly is, medical terms shouldn't belong in a gamechat anyway.
You're right :).
12/13/2009 01:18 ImmuneOne#5
Recent changes:
- Server-side filter added (Compatibility with CoEmu and NewestCOServer v5156)
- filter.txt has been changed in order to let it work with the server-side filter.
- Thread title has been changed.
12/13/2009 13:48 _Emme_#6
An tip:

You done it like:

Quote:
slut
sluts
slutty
slutz
Instead, you can do it like:

Quote:
slut
Store all the bad words in the source, and then check if the message contains any of the bad word, and just replace the bad word with ****. Therefore, if they type 'slutty', it would come out as 'ty'.
12/13/2009 14:15 ImmuneOne#7
Quote:
Originally Posted by EmmeTheCoder View Post
An tip:

You done it like:



Instead, you can do it like:



Store all the bad words in the source, and then check if the message contains any of the bad word, and just replace the bad word with ****. Therefore, if they type 'slutty', it would come out as 'ty'.
Quote:
Message = Message.Replace("Word", "****");
Inserting every word, into the source like that is too much work.
And the concept of this idea that the receiving target doesn't know what he swears with. I could pretty easy figure out what he said if i saw ****ty or ****er
12/16/2009 01:41 .Guru#8
idk if it's possible, but why not just (close to what emme said) if the word includes forsay: "slut", then * the entire word, whether they put "slutTYAGHAGAYAHNHAGAty" or just "slutTY". or disable the chat if that word is in the dialog. ex: Jimmy is speaking to Bob.

Bob: "Dude your mom is so hott"
Jimmy: ""
Bob: "What did you say?"
Jimmy: ""


seeing simply that, it is like an anti-profanity chat system, if the dialog contains a blocked word, then disable the chat that is sent.
12/16/2009 01:54 PeTe Ninja#9
As emme and others said...

search all the words in the message if any contain the word slut then block it out with **** or like some games just clear the message and make it say like " I Love bunnies "
12/16/2009 02:34 ~Falcon#10
Your code could be optimized by a considerable amount.

Your cycling through a text document every single time the chat packet is received.
The better option would be to load the "bad" words at initialization and store them to a collection, saving execution time when chatting.

The coding of the loop isn't great either.

I would do something like this.

Code:
//Declaration of Collection
public static Dictionary<string,string> Filter = new Dictionary<string,string>();

//The filter.txt should always be in the correct directory.
//Use Original word as the key, and the value as the one to replace
//Do this at startup
foreach(string Line in File.ReadAllLines(Directory + @"\Filter.txt"))
{
string[] lSplitter = Line.Split('#');
Filter.Add(lSplitter[0],lSplitter[1]);
}
//Then in your chat.cs
foreach (KeyValuePair<string,string> kvp in Filter)
{
if (message.Contains(kvp.Key))
message = message.Replace(kvp.Key, kvp.Value);
}
Of course, that can still probably be improved, but imo it's superior to your method.
12/16/2009 04:09 PeTe Ninja#11
falcon just owned you ahahhaha
12/16/2009 09:01 ImmuneOne#12
Quote:
Originally Posted by PeTe Ninja View Post
falcon just owned you ahahhaha
Excuse me,
I was never about to give the real function now do i? The fun part of it all is that i don't even use coemu.

Oh and falcon, thanks for trying to help out but i did exact the same and none of the ways (yours and mine) did work at my computer, while they did at my laptop. So thats kinda what's been bugging me and made me do that.