Forums Index >> Modding >> WordFilter Script - Version 0.1
Page : <1> : 2
Uhm I could Help Racer...I know more bad words than ANYONE on ThinkTanks
And he beats the MouthWash!!! Great job racer....Might tweek it to boot em.
P.S. Thx for open source
P.P.S. This better go in utilities
Um....Do we need admin 0.05 for this?
Racer, if you want to make it work on the client side (so you can use it in any server), add this at the bottom of stringclean.cs:
package CleanClientChat {
function onChatMessage(%message)
{
%message = cleanString(%message);
Parent::onChatMessage(%message);
}
};
activatePackage(CleanClientChat);
Last edited: Thursday, February 17, 2005 at 2:30:36 AM
Racer, some big bug,apparently you can type all those words in capital letters and still have the words not filtered.
Next update will include case-sensitivity fix.
Wednesday, February 16, 2005 at 3:18:01 PM
Read the thread before complaining. O_o
Good stuff mista fo' fo' fi'.
I made my own file that has a few more words and fixes the caps bug
go to Zoltar's website
You should put in that it will kick them the first two times or so and then ban them the third. Have a warning though that they will get baned if they keep it up. That would be cool. You also need to add in stuff like @ss and a$$. Lol I just found out if you add hell as a bad word then when someone says hello then it shows it as ****o. I can see why it did that, but I still thought it was funny.
Last edited: Thursday, February 17, 2005 at 7:38:02 PM
Nice, Good Job. Since the mouthwash script never came out this is a great solution!
Heh nice work but... I've tweaked it a LOT, added custom replace messages, correctly numbered **** (one for each letter in the word), added it to a file using commas(,) to separate the word and made it kick at the third time someone swears and other things like fixed a major flaw (try removing the functions named serverCmdSAD and serverCmdSADSetPassword as if somebody uses that script without dash's admin script version 0.03 ppl can just get to be admin if they call a little CommandToServer hehe %) and no I never used it, it wouldnt hurt much if there were ppl in the server as its suposed to tell everybody that person is now an admin :P )
Heh this is much better, as for the case-sensitivity, I dont get those codes too lol
Edit: Hey I found the case sensivity fix!
It is that function its like:
%string = Strreplace( Strlwr(%string), $bannedWords[%num], $replacementWord[%num]);
I got that by doing some research on the matchClientName function lol you should have given it a go!
Its like
Function cleanString(%string)
{
for(%i=0; %i<$numBannedWords; %i++)
{
%string = Strreplace( Strlwr(%string), $bannedWords[%i], $replacementWord[%i] );
}
return %string;
}
For the ones that didnt get it (just replace that function with the one you have on the server side file)
F from function is lower-case!
Last edited: Friday, February 18, 2005 at 1:24:48 PM
No problem racer..
(he maybe a little thanks sentence like to laggy would be kewl :P jk lol)
Dont forget to remove those major flaw functions!
Last edited: Friday, February 18, 2005 at 1:24:09 PM
Ah! I installed the new version and now I can't talk!
Art could you tell us the code to kick players after three times? Also I'd like the one where there is the same number of * as letters in the word.
Why?!!!
@art: FYI strlwr() doesn't work on macs...
How would we be able to remove the all lower-case and add mac compatibility (I fixed it on the server side, but it doesnt seem to like it on the client side...)
Okay, it just got way more complicated. Macs will need to have the ignore script installed to have case insensitive matching.
function cleanString(%string)
{
// find out what string functions are available
if ( strstr(strlwr("oFOO"), "foo") == 1) %useStrFunc = 1; // PC
else if (stristr("oFOO", "foo") == 1) %useStrFunc = 2; // Mac with ignore script installed
else %useStrFunc = 3; // Mac without ignore. Matches will be case sensitive
for(%i=0; %i<$numBannedWords; %i++)
{
if ($bannedWords[%i] $= $replacementWord[%i]) continue; // don't replace the same word with its self
%pos = 0;
while (%pos != -1) // keep looking for the bad word until all are replaced
{
// get the position of the first bad word using the function chosen above
switch$ (%useStrFunc) {
case "1": %pos = strstr(strlwr(%string), strlwr($bannedWords[%i])); // fast and case insensitive
case "2": %pos = stristr(%string, $bannedWords[%i]); // slow and case insensitive
case "3": %pos = strstr(%string, $bannedWords[%i]); // fast but case sensitive
}
// chop the string up cutting out the bad word and replacing it
if (%pos != -1)
{
%string = getSubStr(%string, 0, %pos ) @
$replacementWord[%i] @
getSubStr(%string, %pos + strlen($bannedWords[%i]), strlen(%string));
}
}
}
return %string;
}
Hey thanks laggy, one question, how do we get the number of letter in a word or/in a sentance?
%lengthOfSentance = strlen(%string);
%lengthOfThirdWordInSentance = strlen(getWord(%string, 3));
%numberOfWordsInSentance = getWordCount(%string);
Useful doc: http://www.garagegames.com/downloads/TGE_Console_Cmds.rtf
So, I'm lost guys.
Where are we at with this awesome collaboration?
Case sensitivity resolved for macs?
Great Job.BTW
MAX
Now that I have installed it, my ability to chat is gone. Did I miss directions for installing on a MAC?
I already had a "commands.cs.dso" file which I moved out when I put the "commands.cs" file in the "ThinkTanks/common/server/" folder, knowing the game would over write it.
I uninstalled it. Id rather see creative english then be deaf, dumb and blind.
MAX
Last edited: Sunday, February 20, 2005 at 12:04:25 PM
Point: Repent uses it!!!
Really he uses my tweaked version of it! You can see he has the warnings when you swear (u'll be kicked if u swear many times!)
Still doesn't let me chat.
Well I'll check back later when it works for MAC.
MAX
Lol. There are no real bugs in Art's script, it works beautifully.It censored skys(crap)ers because art had crap as a bad word.
This is a must have script.
Repent.
P.S.
I have a PC.
4/1/1929 to 11/17/2006 Rest in Peace Bo. GO BLUE!!!
Last edited: Sunday, February 20, 2005 at 1:29:43 PM
^
Strange I do not have that problem. But since you know more about it than I do I will take your word for it.
Repent
4/1/1929 to 11/17/2006 Rest in Peace Bo. GO BLUE!!!
Last edited: Sunday, February 20, 2005 at 7:26:20 PM
One thing,
dont set it to boot!
things like skycrapers will boot you you
@Repent
Hey I know u didnt have it, cos I got arround a way for the fix, but if you see, it isnt case sensitive on other's server
(the new fix is!) lol
@Max: I just tested it on a mac here at work the version racer has up currently seems to be working fine. Let me know if you still experience otherwise.
@Racer, there really isn't a need for this to be 2 separate files, since the functions are the same and have the same names, one just overwrites the other. So when clientstringclean.cs gets exec'd, it just overwrites the functions and variables that serverstringclean.cs set up. Getting rid of the extra file would make it easier to install.
Page : <1> : 2
For anyone like me who is annoyied by the idiots of TT, I have come up with WordFilter , an open-soruce script that filters out bad words. I am constantly adding only words, and you can add more if you wish.
For example, if you type in "crap", you will get "****" instead. Pretty ****in cool. :)
NOTES: Original script by Owen Ortmayer, ported to ThinkTanks by Racer445.
-Racer
Thanks Laggy Mon for the code to make a new Client Side version of this. WOOT!
Also thanks to Art Crazy for some major flaw fixes and case sensitivity fix!
Last edited: Tuesday, June 07, 2005 at 6:12:07 AM