mIRC Homepage
Posted By: Jay_T to KingTomato - 12/05/03 06:36 PM
you helped me with this codes it works fine but i still have one problem
Make your text file similar to this:

Word 1|kick
Word2|Warn
Bad Word 1|KickBan

Then as you were doing..

on @1:TEXT:*:%wearchannels: {
if ($isFile(swear.txt)) {
/set -u0 %l 1
while (%l <= $lines(swear.txt)) {
/set -u0 %word $gettok($read(swear.txt, %l), 1, 124)
if ( isin $1-) {
/set -u0 %action $gettok($read(swear.txt, %l), 2, 124)
if (%action == Kick) { /kick $chan $nick You have been kicked for swearing ( $+ $replace(%word,a,?,e,?,i,?,o,?,u,?) $+ ) }
else if (%action == KickB) {
/mode $chan -ov+b $nick $nick $nick
/kick $chan $nick You have been kick-banned for swearing ( $+ $replace(%word,a,?,e,?,i,?,o,?,u,?) $+ )
}
else { /msg $chan $nick $+ , Please do not say $replace(%word,a,?,e,?,i,?,o,?,u,?) again. }

}
/inc -u0 %l
}
}
}

That will look for the word through the text file, then based on the action listed after the word and the |, it will take action. It iwll look for Kick, or Kickb, or otherwise default to just warning the person.



-KingTomato
http://www.kingtomato.com/
AIM: otamoTgniK

yes it kicked but if i set my first bad word is:
(1)bad|KickB then it will kick and banned
but this is the problem if i set another word:
(2)bad word|Kick
then it only go to the (1) and doesnt go to (2) is anyway to fix this thanks
what i want is when someone say "bad" then it will kick and banned but if someone say "bad word" then it will kick only
Posted By: Jerk Re: to KingTomato - 12/05/03 07:12 PM
It's not to me but I will reply anyway.

For this to work correctly you will need to order your swear.txt file properly. The script should loop through the entire text file (which it really ought not to do after it finds its first match). The problem is that once you kick ban someone how will you kick them again? Order your swear.txt from most specific to least specific.

Bad Word 1|KickBan
Word 1|kick
Word2|Warn

Edited code:
Code:
on @1:TEXT:*:%wearchannels: {
  if ($isFile(swear.txt)) {
    var %l = 1
    while (%l &lt;= $lines(swear.txt)) {
      var %fullline = $read(swear.txt,n,%l)
      var %word = $gettok(%fullline,1,124)
      if (%word isin $1-) {
        var %action = $gettok(%fullline,2,124)
        if (%action == Kick) { kick $chan $nick You have been kicked for swearing ( $+ $replace(%word,a,?,e,?,i,?,o,?,u,?) $+ ) }
        else if (%action == KickB) {
          mode $chan -ov+b $nick $nick $address($nick,3)
          kick $chan $nick You have been kick-banned for swearing ( $+ $replace(%word,a,?,e,?,i,?,o,?,u,?) $+ )
        }
        else { msg $chan $nick $+ , Please do not say $replace(%word,a,?,e,?,i,?,o,?,u,?) again. }
        return 
      }
      inc %l
    }
  }
}
I took out the set -u's and used var instead. Also made the script read each line only once. If you are going to have lots of swears this script will bog you down considerably. It has to read each line in the swear.txt file for every line of text sent to the channel. A busy channel combined with a large swear word list can be nasty. Better to hard code your swear list [if (blah isin $1-) || (bad isin $1-)...] or use a hash table
Posted By: krunch Re: to KingTomato - 13/05/03 12:43 AM
or you could use $read(file.txt, w, %badword)
Code:
on *:text:*:#:{
var %i = 1
while (%i &lt;= $numtok($1-,32)) {
if ($read(file.txt, w, $gettok($1-,%i,32)) {
$gettok($read(file.txt, w, $gettok($1-,%i,32),2,124) # $nick bad word
}
inc %i
}
}


just make in the file
badword | kick
badword | kickban

and then make a small alias like this
Code:
alias kickban {
ban $1 $2
kick $1 $2 $3
}

something like that
© mIRC Discussion Forums