Carim123 Posted August 19, 2011 Author Share Posted August 19, 2011 Next tutorial, a (HARD-CODED.) Swear Filter!To add words, add it in the SwearWords = "HERE" declaration, and MAKE SURE THERE ARE NO SPACES.The filter works case-insensitively, so there is no need to do "test,TEST,Test,tEst,teSt" etc.Firstly, everything is server-side, so in modDatabase (Or any module you like…) add;```Public Function CheckForSwears(Index As Long, Msg As String)' Carim's Swear Filter. GIVE CREDIT.Dim SplitStr() As StringDim SwearWords As StringDim i As Integer ' There are NO spaces between each swear. SwearWords = "ass,test,etc,female dog" SplitStr = split(SwearWords, ",") For i = 0 To UBound(SplitStr) If InStr(1, LCase(Msg$), SplitStr(i), 1) Then Msg = Replace$((Msg), (SplitStr(i)), LCase(String(Len(SplitStr(i)), "*")), , , 1) End If Next iEnd Function```Now, in Sub HandleSayMsg, Sub HandleEmoteMsg, Sub HandleBroadcastMsg, wherever you have something you want to check, add``` Call CheckForSwears(Index, Msg)```Above "Call AddLog***".And, after adding the Call in the three appropiate cases, in my case, save and compile, test it with all your channels, and it should block out the word, and any word containing said word.Unfortunately, it makes Assessment turn into ***essment, and Assassin into ******in, but I haven't figured that out yet. xDCREDIT OBSIDIAN. Link to comment Share on other sites More sharing options...
Robin Posted August 19, 2011 Share Posted August 19, 2011 So you're re-posting a tutorial made for Mirage in 2003 which was then revived by someone in Elysium in 2005 which was then revived by someone in Eclipse in 2007 which is now being revived by you in 2011… and you want credit for removing a line?lolwat. Link to comment Share on other sites More sharing options...
Carim123 Posted August 19, 2011 Author Share Posted August 19, 2011 @Robin:> So you're re-posting a tutorial made for Mirage in 2003 which was then revived by someone in Elysium in 2005 which was then revived by someone in Eclipse in 2007 which is now being revived by you in 2011… and you want credit for removing a line?> > lolwat.Not really. A friend dared me to add it as a joke, but it kinda backfired here, so I may as well remove it. ^_^Wanted to see how I could play along.Was expecting to see the result of various newbies, but like I said; backfired. v_v Link to comment Share on other sites More sharing options...
Beanie93 Posted August 19, 2011 Share Posted August 19, 2011 @7:> Not really. A friend dared me to add it as a joke, but it kinda backfired here, so I may as well remove it. ^_^Yes, that'd be me. Link to comment Share on other sites More sharing options...
Ryochi Posted August 20, 2011 Share Posted August 20, 2011 @Robin:> So you're re-posting a tutorial made for Mirage in 2003 which was then revived by someone in Elysium in 2005 which was then revived by someone in Eclipse in 2007 which is now being revived by you in 2011… and you want credit for removing a line?> > lolwat.… Quadruple fail! Lol. Link to comment Share on other sites More sharing options...
tjstock Posted August 20, 2011 Share Posted August 20, 2011 Meh I dont care if its been done before, saves me the trouble of hunting it down. Thanks 7 Link to comment Share on other sites More sharing options...
Carim123 Posted August 20, 2011 Author Share Posted August 20, 2011 @Ryochi:> … Quadruple fail! Lol.Read the two posts above yours, rather than trying to buttlick Robin.@Heilo:> Meh I dont care if its been done before, saves me the trouble of hunting it down. Thanks 7Nice to know it helps. Link to comment Share on other sites More sharing options...
Likestodraw Posted November 3, 2011 Share Posted November 3, 2011 Yay, I don't have to hunt it down! Thank you for your total failness that brought me this.Now to show off my failness- What file is the last part supposed to go in? Link to comment Share on other sites More sharing options...
lexkymbeth Posted November 6, 2011 Share Posted November 6, 2011 um how could you let admins swear. i tryed```If GetPlayerAccess(Index) > 4 ThenExit FunctionEnd If```above```SwearWords = "test"```but didn't workEdit nvm -. found it```If GetPlayerAccess(Index) > 3 Then ' or = 4Exit FunctionEnd If``` Link to comment Share on other sites More sharing options...
Baron Posted November 6, 2011 Share Posted November 6, 2011 The funny thing is that this is as ineffectual as tits on a bull.To make them effective the code has to be able to break leetspeak as well as cyrillic similar characters.ie to make fuck3r filtered as well as fùcker etc Link to comment Share on other sites More sharing options...
lexkymbeth Posted November 6, 2011 Share Posted November 6, 2011 i agree.. i'm trying to figure out a better way. but this will do for now btw. if u say fuck3r it would = ****3r lol Link to comment Share on other sites More sharing options...
Carim123 Posted November 6, 2011 Author Share Posted November 6, 2011 Easy, just make it a rule where attempting to use a loophole with the swear filter results in warnings/mutes.Works for forums and most ORPGs, don't see why it can't work here.Or, you could make some form of AI to add anything that's linked to the words.ie ****er, and the server automatically adds ******. Not difficult, but I'm not sharing. =DOf course, there's a flaw with that too, but there'll always be a flaw in something so variable. Link to comment Share on other sites More sharing options...
lexkymbeth Posted November 6, 2011 Share Posted November 6, 2011 ha yea. i just spent 2 hours with this code and make a rely good sever MSG poacher if some one say "i can hack" my sever pops up and tells me who it was and more stufff.. lol thanks btw i didn't know about the MSG part i was looking for it the other day Link to comment Share on other sites More sharing options...
badrobot Posted February 29, 2012 Share Posted February 29, 2012 Will this work in CS:DE? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now