IceChat Forums

IceChat 7 => IceChat 7 Scripts => Topic started by: Yugi on April 30, 2008, 04:11:22 PM

Title: Query blocker (modified)
Post by: Yugi on April 30, 2008, 04:11:22 PM
*echoing back "Query blocked" in the current window
*fixed /partallquery with /closequery

Code: [Select]
'check for word matches in Query

Dim BadWords, Count,x
Redim BadWords(0)

Count = GetIdentifier("$lines(badwords.txt)")
for x = 1 to Count
  Redim Preserve BadWords(x)
  BadWords(x)  = GetIdentifier("$read(badwords.txt," & x & ")")

Function CheckWord(message)
'check for bad words list
dim i, j, words
words = Split(message, " ")
for i = 0 to Count-1
  for j = 0 to UBound(Words)  
     if lcase(Words(j)) = lcase(BadWords(i)) then
        CheckWord = True
        Exit Function
     end if

End Function

Sub ONQUERY(Message,Nickname,Host,ServerNumber)
if CheckWord(Message) = True Then
  'ignore the user using $mask(FullHost,2) which is *!*@host
  SendCommand "//ignore $mask(" & NickName & "!" & Host & ",2)",ServerNumber
  SendCommand "/print Query blocked with " & nickname
  'Close the Query Window
  SendCommand "/closequery " & Nickname,ServerNumber
end if
End Sub

all the credits for this go to Dark`Star for fixing this script and ofcourse to Snerf  :-D