antiamsg - amsg

Paste Your small code(s) here, ex. small aliases, identifiers

antiamsg - amsg

Postby Cristian » Sun Apr 12, 2009 10:07 pm

just an old script I found in my folder, used to detect and ban antiamsg offenders, while channel mode +T wasn't present. (Quakenet)

It have a window, where it echos the result of offenders.

The reaction level will reset after third offense, find this line, and comment it and it won't reset reaction levels:
hdel amsg $+(amsg.,$2,.,$comchan($1,%x),.react)

The current reaction levels are 1, 2, and over 2

Code: Select all
alias -l ::antiamsg::message { return <message to user when first amsg is detected> }
alias -l ::antiamsg::kickmessage { return <kickmessage to user when second amsg is detected> }
alias -l ::antiamsg::banmessage { return <banmessage to user when third amsg is detected> }

on ^!*:ACTION:*:#:{
  aamsg $email $chan $nick $address($nick,1) $encode($replace($1-,$chr(32),$chr(175),$chr(124),$chr(182)),m)
}
on ^!*:TEXT:*:#:{
  aamsg $email $chan $nick $address($nick,1) $encode($replace($1-,$chr(32),$chr(175),$chr(124),$chr(182)),m)
}
alias aamsg {
  if ($hget(amsg,$+(amsg.,$3,.line)) == $5-) {
    if (!$istok($hget(amsg,$+(amsg.,$3,.chan)),$2,32)) { hadd -mu10 amsg $+(amsg.,$3,.chan) $hget(amsg,$+(amsg.,$3,.chan)) $2 }
  }
  if (!$hget(amsg,$+(amsg.,$3,.chan))) { hadd -mu10 amsg $+(amsg.,$3,.chan) $2 }

  hadd -mu10 amsg $+(amsg.,$3,.line) $5-
  hadd -mu10 amsg $+(amsg.,$3,.nick) $3
  hadd -mu10 amsg $+(amsg.,$3,.host) $4
  if ($numtok($hget(amsg,$+(amsg.,$3,.chan)),32) > 1) {
    if (!$timer(. [ $+ [ $3 ] ])) {
      .timer. [ $+ [ $3 ] ] 1 5 antiamsg $hget(amsg,$+(amsg.,$3,.nick)) $hget(amsg,$+(amsg.,$3,.host)) $hget(amsg,$+(amsg.,$3,.line))
    }
  }
}
;1  $hget(amsg,$+(amsg.,$3,.nick))
;2  $hget(amsg,$+(amsg.,$3,.host))
;3  $hget(amsg,$+(amsg.,$3,.line))

alias antiamsg {   
  if (!$window(@Anti_amsg)) { .window -emz @Anti_amsg }
  if ($numtok($hget(amsg,$+(amsg.,$1,.chan)),32) > 1) {
    var %t = $numtok($hget(amsg,$+(amsg.,$1,.chan)),32)
    var %channels = $hget(amsg,$+(amsg.,$1,.chan))
    var %hostname = $hget(amsg,$+(amsg.,$1,.host))

    var %z = $comchan($1,0)
    var %x = 1
    while (%x <= %z) {
      if (!$hget(amsg,$+(amsg.,$2,.,$comchan($1,%x),.react))) { hadd -m amsg $+(amsg.,$2,.,$comchan($1,%x),.react) 1 } | else { hinc -m amsg $+(amsg.,$2,.,$comchan($1,%x),.react) 1 }
      if ($me isop $comchan($1,%x)) {
        if ($hget(amsg,$+(amsg.,$2,.,$comchan($1,%x),.react)) == 1) && ($istok(%channels,$comchan($1,%x),32)) { msg $1 $::antiamsg::message }
        elseif ($hget(amsg,$+(amsg.,$2,.,$comchan($1,%x),.react)) == 2) && ($istok(%channels,$comchan($1,%x),32)) {
          var %x = $numtok(%channels) {
            while (%x) {
              var %chan = $gettok(%channels,%x,32)
              kick %chan $1 $::antiamsg::kickmessage
              dec %x
            }
          }
          elseif ($hget(amsg,$+(amsg.,$2,.,$comchan($1,%x),.react)) > 2) && ($istok(%channels,$comchan($1,%x),32)) {
            var %x = $numtok(%channels)
            var %time = $calc($hget(amsg,$+(amsg.,$2,.,$comchan($1,%x),.react)) * 100)

            while (%x) {
              var %chan = $gettok(%channels,%x,32)
              .ban $+(-ku,%time) %chan $1 1
              kick %chan $1 $::antiamsg::banmessage
              dec %x
            }
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;comment this line (below), if you don't want to reset the reaction levels.;;;;;;;
            hdel amsg $+(amsg.,$2,.,$comchan($1,%x),.react)
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
          }
        }
        inc %x
      }
      inc %amsg.count 1

      echo @Anti_amsg $+($chr(3),07,$timestamp) *** %pp1 Nick $1 %pp2 Made an Amsg/Ame in %pp2 %t Channels %pp2 ( $+ %channels $+ ) %pp2 %spam.count %pp3
      echo @Anti_amsg $+($chr(3),07,$timestamp) *** %pp1 Nick $1 %pp2 $replace($decode($3-,m),$chr(175),$chr(32)) %pp3

    }
    break
  }
}
Cristian
proof of advance
proof of advance
 
Posts: 282
Joined: Sun Nov 04, 2007 3:02 pm
Location: Denmark
Authnick: Sumsar

Return to Mirc Scripting Snippets

Who is online

Users browsing this forum: No registered users and 3 guests

cron