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 =
-------------
|