mIRC Home    About    Download    Register    News    Help

Print Thread
Help Needed for a Script. *please* #267566 10/08/20 12:25 PM
Joined: Aug 2020
Posts: 2
D
Dracula Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
D
Joined: Aug 2020
Posts: 2
Hey guys, i hope you are doing very well, i just needed a script if you could provide. the script should be, if anyone spams on a channel with like (200 no of words or 2 lines) the script should trigger and turn on the mode (+m) by its own when am on the channel. thanks in advance.

Re: Help Needed for a Script. *please* [Re: Dracula] #267774 24/09/20 06:53 AM
Joined: Jan 2012
Posts: 11
Epic Offline
Pikka bird
Offline
Pikka bird
Joined: Jan 2012
Posts: 11
I read your request and decided to try writing my own script, and this is what I got cool
3 types of protective checks for flooding, installation and automatic removal of the mode on the channel and kick on the bully's nickname.
All control in the alias "af_data". You can enable and disable different types of verification separately, as well as adjust the number of actions and the number of seconds after which need to respond.

Code
#####################################################################
#   AntiFlood v1.0
#   Description: Catching different types of flood on channels
#   Author: Epic
#####################################################################

alias af_data {
  .hadd -m af check-mess true
  .hadd -m af check-rep true
  .hadd -m af check-words true
  .hadd -m af check-mode true
  .hadd -m af check-kick true
  ;---------------------------
  .hadd -m af max-mess 5
  .hadd -m af max-mess-sec 3
  .hadd -m af max-rep 3
  .hadd -m af max-rep-sec 10
  .hadd -m af max-words 200
  .hadd -m af max-words-sec 10
  .hadd -m af mode +m
  .hadd -m af demode -m
  .hadd -m af mode-sec 300
  .hadd -m af reason flood/spam
}
====================================================
alias afcheck {
  var %af_check count- $+ $1 $+ $2
  if ($prop == rep) return $hget(af_rep,%af_check)
  if ($prop == rsec) return $hget(af_rsec,%af_check)
  if ($prop == mes) return $hget(af_mess,%af_check)
  if ($prop == msec) return $hget(af_msec,%af_check)
  if ($prop == words) return $hget(af_words,%af_check)
  if ($prop == wsec) return $hget(af_wsec,%af_check)
}
alias af_count_mes {
  var %af_count count- $+ $1 $+ $2
  if (!$hget(af_msec,%af_count)) .hadd -mz af_msec %af_count $hget(af,max-mess-sec)
  if (!$hget(af_mess,%af_count)) .hadd -mu $+ $hget(af,max-mess-sec) af_mess %af_count 0
  if ($hget(af_msec,%af_count) > 0) .hinc -m af_mess %af_count 1
}
alias af_count_rep {
  var %af_count count- $+ $1 $+ $2
  if (!$hget(af_rsec,%af_count)) || ($3- !isin $hget(af_rep_text,%af_count)) {
    .hadd -mz af_rsec %af_count $hget(af,max-rep-sec)
    .hadd -mu $+ $hget(af,max-rep-sec) af_rep %af_count 0
    .hadd -m af_rep_text %af_count $3-
  }
  else { .hinc -mu $+ $hget(af,max-rep-sec) af_rep %af_count 1 }
}
alias af_count_words {
  var %af_count count- $+ $1 $+ $2
  if (!$hget(af_wsec,%af_count)) .hadd -mz af_wsec %af_count $hget(af,max-words-sec)
  if (!$hget(af_words,%af_count)) .hadd -mu $+ $hget(af,max-words-sec) af_words %af_count 0
  if ($hget(af_wsec,%af_count) > 0) .hinc -m af_words %af_count $numtok($3-,32)
}
====================================================
on *:TEXT:*:#:{
  af_data | var %af_count count- $+ $nick $+ $chan
  if ($hget(af,check-mess) == true) af_count_mes $nick $chan
  if ($hget(af,check-rep) == true) af_count_rep $nick $chan $1-
  if ($hget(af,check-words) == true) af_count_words $nick $chan $strip($1-)

  ;# Debug check script echo
  ;/echo -s 28debug:18 $nick $chan 28 message:53 $hget(af_mess,%af_count) $hget(af_msec,%af_count) 28 repeat:41 $hget(af_rep,%af_count) $hget(af_rsec,%af_count) 28 words:29 $hget(af_words,%af_count) $hget(af_wsec,%af_count)

  if ($afcheck($nick,$chan).mes >= $hget(af,max-mess) && $afcheck($nick,$chan).msec > 0) {
    /echo -a FLOOD $chan $nick :40 $afcheck($nick,$chan).mes messages in40 $hget(af,max-mess-sec) seconds.
    if ($hget(af,check-mode) == true) af_mode_chan $nick $chan
    if ($hget(af_mess,%af_count)) .hdel -sw af_mess count-* | if ($hget(af_msec,%af_count)) .hdel -sw af_msec count-*
  }
  if ($afcheck($nick,$chan).rep >= $hget(af,max-rep) && $afcheck($nick,$chan).rsec > 0) {
    /echo -a FLOOD $chan $nick :40 $afcheck($nick,$chan).rep reps in40 $hget(af,max-rep-sec) seconds.
    if ($hget(af,check-mode) == true) af_mode_chan $nick $chan
    if ($hget(af_rep,%af_count)) .hdel -sw af_rep count-* | if ($hget(af_rsec,%af_count)) .hdel -sw af_rsec count-*
  }
  if ($afcheck($nick,$chan).words >= $hget(af,max-words) && $afcheck($nick,$chan).wsec > 0) {
    /echo -a FLOOD $chan $nick :40 $afcheck($nick,$chan).words words in40 $hget(af,max-words-sec) seconds.
    if ($hget(af,check-mode) == true) af_mode_chan $nick $chan
    if ($hget(af_words,%af_count)) .hdel -sw af_words count-* | if ($hget(af_wsec,%af_count)) .hdel -sw af_wsec count-*
  }
}
====================================================
alias af_mode_chan {
  if ($hget(af,check-kick) == true) /kick $2 $1 $hget(af,reason)
  if (!$timer(AF $+ $2)) {
    /mode $2 $hget(af,mode)
    .timerAF $+ $2 1 $hget(af,mode-sec) /mode $2 $hget(af,demode)
  }
}
====================================================