![]() |
Client Swear Filter With Replaces - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: Client Swear Filter With Replaces (/showthread.php?tid=2173) |
Client Swear Filter With Replaces - JokeofWeek - 23-09-2008 This is based on William's tutorial. I found it a little unoptimized. So I did a little modification to it, and I also added in a replacing system. . First, in mod Globals, go add the following : Code: Public SwearArray() as string Now, go to sub Main. At the top, declare the following variable : Code: Public SwearString as string In the same sub, right after : Code: Call CheckTiles add : Code: ' Use the swear string to store the original swear words Now, to add in your own words, just add the swear word to the first string, and then add the replacement to the second string ![]() Now, just add this function (a modified version of CheckMessage) : Code: Public Function CheckMessage(byval Msg As String) As String And there you go, you now have an optimized chat filter system which replaces swears with what you want them to. And, to quote william,: Quote:Now search for all the different messages: adminmsg, saymsg, broadcastmsg, globalmsg, playermsg, mapmsg. Re: Client Swear Filter With Replaces - GIAKEN - 23-09-2008 Unfortunately, it won't work...it will only replace the last swear word in the string. Like this: Msg = "shit whore fuck bitch" for example... CheckMessage = "**** whore fuck bitch" but Msg is still the same so it will look for the second swear...so then CheckMessage = "shit ***** fuck bitch" and then Msg will still equal the same thing...so you do: Code: Public Function CheckMessage(byval Msg As String) As String Also changed i to a Long because it's the fastest type to use for loops. Re: Client Swear Filter With Replaces - JokeofWeek - 23-09-2008 GIAKEN Wrote:Unfortunately, it won't work...it will only replace the last swear word in the string. Like this: Ah true, thanks for that first fix, hadn't thought of that. And yeah, I thought of using I as a long for the loop, I'll probably do that ![]() ![]() |