Print Page | Close Window

Swear Filter

Printed From: Mirage Source
Category: Tutorials
Forum Name: Submitted Tutorials
Forum Discription: Tutorial submissions for MSE are posted here, waiting for approval
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=537
Printed Date: 20 December 2006 at 6:07pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Swear Filter
Posted By: Obsidian
Subject: Swear Filter
Date Posted: 26 March 2006 at 1:40pm
Difficulty: 1/5 - Very Easy

This is a very basic swear filter, the list is completely customizable and Easy to use.

:::::::::::::::::::::::::::::::::::::::::::
:: This is ALL Server Side!!!! ::
:::::::::::::::::::::::::::::::::::::::::::


First, We need to setup the checks for the swears. Open modHandleData and search for


If LCase(Parse(0)) = "saymsg" Then


in this packet, after you see.


' Prevent hacking
        For i = 1 To Len(Msg)
             If Asc(Mid$(Msg, i, 1)) < 32 Or Asc(Mid$(Msg, i, 1)) > 126 Then
                 Call HackingAttempt(Index, "Say Text Modification")
                 Exit Sub
             End If
        Next i


You need to add

Call CheckMessage(Index, Msg)



All you have to do, is add that in the same exact spot for every type of chat that you want censored. (Admin, Global, Broadcast, Emote, Ect.)


Now, at the bottom of modDatabase (or wherever, I just use Database) add this Function.


Public Function CheckMessage(Index As Long, Msg As String)
Dim kArray() As String
Dim Swears As String
Dim i As Integer
Dim SwearChar As String
  
    Swears = "ass,f**k,sh*t,bitch,damn,"
    kArray = Split(Swears, ",")
   
    SwearChar = "*"
    
    ' Thanks to Classified For Help with the Full Word Replacement
    For i = 0 To UBound(kArray)
        If InStr(LCase(Msg$), LCase(kArray(i))) Then
             'Msg = Replace(Msg, kArray(i), SwearChar)
             Msg$ = Replace$(LCase(Msg$), LCase(kArray(i)), LCase(String(Len(kArray(i)), SwearChar)))
        End If
    Next i
End Function


Now, all you have to do is change the swear char (if you'd like) and then add to the Swears =.

Please Post any Comments/Suggestions.

[Edit]
I'd just like to point out... that the forum automatically censors f**k, and sh*t... so don't include the * in your Swears =


-------------



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info