mIRC Home    About    Download    Register    News    Help

Print Thread
Badword Filter #139686 17/01/06 04:38 PM
Joined: Jan 2006
Posts: 3
A
apinner Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Jan 2006
Posts: 3
Hi,

I have recently been asked to help setup a channel, but due to the nature of the channel swearing is not appreciated. I am really struggling to find a piece of code that will do what i want, i created a instant kick script when it picks up a swear word but this is a bit harsh.

I am looking for some script that will operate a 3 strikes and your out policy, so should any one user swear 3 times in the space of 24 hours they get a kick ban for 5 minutes. So the first 2 times they just recieve a reminder of the channel policies.

Any help that could be given on this would be much much appreciated as i have been searching for something for days and i just do not have enough scripting knowlege myself to do it.

Thanks in advance

Re: Badword Filter #139687 18/01/06 01:39 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The following script requires the person/bot that's running the script to have ops in the channel, and for the swear words to be in a text file called swear.txt with one word per line
Code:
 on @*:text:*:#:{
  var %a = 1, %b = $0
  while %a <= %b {
    if $read(swear.txt,nt,$gettok($1-,%a,32)) {
      inc -u86400 $+(%,swear.,$address)
      .msg $chan No swearing $nick
      .msg $chan This is your $ord($($+(%,swear.,$address),2)) warning
      if $($+(%,swear.,$address),2) > 2  {
        .ban -ku300 $chan $nick Swearing
        .msg $bnick No swearing in $chan
      }
    }
    inc %a
  }
}
 

Last edited by RusselB; 18/01/06 01:40 AM.
Re: Badword Filter #139688 18/01/06 03:07 PM
Joined: Jan 2006
Posts: 3
A
apinner Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Jan 2006
Posts: 3
I shall try it when i get home, thank you very very much for you help!

Re: Badword Filter #139689 18/01/06 06:31 PM
Joined: Jan 2006
Posts: 3
A
apinner Offline OP
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Jan 2006
Posts: 3
Right, i have just tested the script and there is one problem

No matter what text is said in the channel it tells me that it is a swear word, and i have created the text file swear.txt as you said and filled in the bad words one on each line.

Can anyone help on this

Much appreciated

Re: Badword Filter #139690 18/01/06 07:12 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on @*:text:*:#:{
  if ([color:red]%word.kick == on[/color]) {
    set %badword.line 1
    :badword
    if ( $read -l $+ %badword.line " $+ $mircdir\badwords.txt $+ " == $null ) { halt }
    elseif ( $read -l $+ %badword.line $mircdir\badwords.txt isin $1- ) { set %badkick nick $1 | set %badchan $chan | goto badwordkick }
    else { inc %badword.line | goto badword }
    :badwordkick
    if ([color:red]%ban.bad.word == on[/color]) ban -u [ $+ [ [color:red]%bad-word-ban[/color] ] ] $chan $nick 3
    kick # $nick [color:red]Don't swear in my channel[/color]
    else { halt }
    :end
  }
}

editable settings is marked with red

set %word.kick off/on (Disable/enable the kicker)
set %ban.bad.word off/on (Disable/enable ban)
set %bad-word-ban xxx (How long to ban, 60 = 1 minute, 120 = 2 minutes and so on)
Don't swear in my channel (Change to what u want to have as kick msg)

I know the code arent so nicely written, but it working, and thats the main point? wink grin

--------- Edit

I forgot, all words is stored in a txt file "badwords.txt" put that in your mirc dir.. "C:\mirc" or where you installed it, enter the words you want to kick on in that file, done.

Last edited by sparta; 18/01/06 07:18 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: Badword Filter #139691 18/01/06 10:24 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on @*:text:*:#:{
  [color:blue]tokenize 32 $strip($1-)[/color]
  var %a = 1, %b = $0
  while %a <= %b {
    [color:blue]if ($read(swear.txt,nts,$gettok($1-,%a,32)) || $readn) {[/color]
      inc -u86400 $+(%,swear.,$address)
      .msg $chan No swearing $nick
      .msg $chan This is your $ord($($+(%,swear.,$address),2)) warning
      if $($+(%,swear.,$address),2) > 2  {
        .ban -ku300 $chan $nick Swearing
        .msg $bnick No swearing in $chan
      }
      [color:blue]return[/color]
    }
    inc %a
  }
}


Blue lines were added or edited.

First removes color codes extra from the line, people put them in to try and avoid the swearword detection.

Second was the only real fix, Russel just forgot the s (maybe w) flag, to seach for the matching word, since s flag shows only the text on the line minus the word, the line often comes back empty but found, so $readn is used to sence if a line was located.

Third added a return to exit once the first badword is detected, bit hard on someone to be told they had 3 warings all for the same line of text smile