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.
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'.
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
idk if it's possible, but why not just (close to what emme said) if the word includes forsay: "****", 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.
search all the words in the message if any contain the word **** then block it out with **** or like some games just clear the message and make it say like " I Love bunnies "
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.
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.
3 - Words Story 07/17/2010 - Off Topic - 5 Replies Hallo ersmal :D
ich bin mir nich sicher ob so ein Thema nicht vielleicht doch verboten ist wegen der meiner meinung nach großen "spamm gefahr"
egal ... hoffe der thread bleibt eine weile offen
Hello epvpers :D
I'm not sure if this Topic is not allowed, because auf the danger of becoming a spamm thread. but I hope this Thread will stay open for a while
Nun zum Thema:
Now the Topic:
[JUST 4 FUN] A 3 WORDS STORY 03/01/2010 - Soldier Front Philippines - 19 Replies NOTE: STORY ABOUT THE GAME ONLY....
Umpisahan ko na....
Sumali ako sa.....
[How to]Own a Gm with Words 12/14/2009 - Metin2 Guides & Templates - 32 Replies Also ich sage euch heute wie ihr einen Gm mit puren Worten ownen könnt und dafür kriegt ihr kein Ban.
Macht euch mehrere Chars und tut eine z.B Al bennenen und den andere och stellt die nebeneinander. So könnt ihr z.B Sätze bilde wie Du Ar sch loch G. M
oder so irgendwas lasst eurer Fantasie freien lauf. :D
Vill mache ich noch ein Vid rein :D.
HéHé euer Stupido Mizu