mIRC Home    About    Download    Register    News    Help

Print Thread
#162889 23/10/06 05:38 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Hi again blush
erm we have users who join channels and msg the channel like SPAM SPAM SPAM etc like a 100 times so i made this pathectic attempt to script a protection and would like some advice and maybe a better code for it etc.

Code:
  ON @*:TEXT:*:#: {
  if $len($strip($1-)) > 45 {
    var %lol = $gettok($1-,4,32)
    if $gettok($1-,5,32) == %lol) && $gettok($1-,8,32) == %lol) && $gettok($1-,15,32) == %lol) {
      ban -k # $nick 3 SPAMMER
    }
  }
}


thanks alot


Newbie
#162890 23/10/06 06:29 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
if ($matchtok($1-,word,0,32) > 5) { do stuff }

matchtok with Nth being 0 would return the x amount of times that word is in $1- :P


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
#162891 23/10/06 06:36 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If you want to know the amount of times a word (that is a sequence of non-whitespace characters, delimited by spaces), then you should use $findtok($1-,<word>,0,32)

Observe your solution:

//echo -a > $matchtok(grass,ass,0,32)
--> 1

I don't know about you, but there's nothing wrong with saying "grass", it's not the same as "ass".

On the other hand:

//echo -a > $findtok(grass,ass,0,32)


--> 0

Note that $findtok is not the perfect solution either, what if someone says: "you are such an ass!" that won't be triggered, because of the !

It all comes down to how well you want to do the matching, and what amount of false positives you are willing to allow. In the end, you'll probably be served best with a $regex, as it allows you to lay down the rules of matching in a detailed way. An example would be that you would allow the word to be surrounded by non-word characters such as punctuation. That would combine the advantages of both $matchtok and $findtok, with none of the negatives.


Gone.
#162892 23/10/06 07:25 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
thats great advice thanks.


Newbie

Link Copied to Clipboard