Skip to content
Buzzen Chat Network

Long Text Kick Help

A TG007 community discussion started by CharmedOne.

Discussion 2 posts
Page 1 of 1
Open
Topic #11781 · 2 published posts · 1,135 views

Ok this works but it kicks people who type long sentence's rather than someone using a long text like a flooder i seen that did lololololololololololololololololololololololol. I hate to have it kick the wrong people what did i do wrong :pizza:

 

 

on @!*:text:*:#:{ 
;LongText
  if ($readini($settings(chanoptions.txt),$iif($ini($settings(chanoptions.txt),#,0) != 0,#,Default),LongText)) {
    if ( $me isop # ) {
      var %length = $len($1-)
      if ( %length > 15 ) {
        /access $chan add deny $+(*!*, $Ial($nick).addr) 1 :Long-Text
        /kick # $nick No Long Text One min Ban 
      }
    }
  }
}

ok... for starters...

    if ( $me isop # ) {

is not needed because you have used the prefix @. In mIRC help file, look up "prefixes".

 

and you should combine if statements if possible. with your code, you have nested statements, but no alternatives within the nested loops so you can join it using &&.

 

now, we can use regular expression for this, saves having to divide the string up and find out each word's length.

 

your final code should look like this...

on @!*:text:*:#:{ 
;LongText
  if ($readini($settings(chanoptions.txt),$iif($ini($settings(chanoptions.txt),#,0) != 0,#,Default),LongText) && $regex($1-, /([^ ]{15,})/g) > 0) {
    /access $chan add deny $+(*!*, $Ial($nick).addr) 1 :Long-Text
    /kick # $nick No Long Text One min Ban 
  }
}

the regex will return how many words longer than 15 in length.

 

for convention, you should stick to one coding style. use # or $chan, try not to cross between.