It triggers whenever a ban is set or removed. It goes through your ial(Internal Address List) to find the nick associated with the address. It'll echo the results in the channel with colours :D Hope you like it.
on *:BAN:#:banfinder
on *:UNBAN:#:banfinder
alias -l banfinder {
var %x = 1
var %nicks = $null
while ($nick($active,%x)) {
if ($banmask iswm $ial($banmask,%x)) {
var %nicks $addtok(%nicks,$ialchan($banmask,$chan,%x).nick,32)
inc %x
}
else {
inc %x
}
}
if (%nicks == $null) { halt }
var %nicks = $replace(%nicks,$chr(32),$chr(44) $+ $chr(32))
echo -t $chan $iif($event = ban,$+($chr(3),7,Ban),$+($chr(3),7,Unban)) $&
of14 $banmask 07by14 $nick $+ ( $+ $remove($address($nick,1),*!*) $+ ) 07affects:14 %nicks $+ 07.
}
:P Gummo. Thanks for spotting that, but if you looked closely, the only suggestion I made was for Tidum to combine two same routines using an alias to save some bytes. I didn't even look at the actual, original code. I should have done so though. As you should have seen, I copied it straight from him. While I'm at it, I might as well take your word for it and fix it:
on *:ban:#:banfinder
on *:unban:#:banfinder
alias -l banfinder {
var %x 1, %y $remove($address($nick,1),*!*)
while $nick($active,%x) {
if $banmask iswm $ial($banmask,%x) {
var %nicks $addtok(%nicks,$ialchan($banmask,$chan,%x).nick,32)
inc %x
}
echo -t # $iif($event = ban,$+($chr(3),7,Ban),$+($chr(3),7,Unban)) $&
of14 $banmask 07by14 $nick $+ ( $+ %y $+ ) 07affects:14 %nicks $+ 07.
}
}
Well for starters, you don't need two routines, which they're doing the same thing anyway, per ban and unban event. This will do the trick just dandy:
on *:BAN:#:banfinder
on *:UNBAN:#:banfinder
alias -l banfinder {
var %x = 1
var %nicks = $null
while ($nick($active,%x)) {
if ($banmask iswm $ial($banmask,%x)) {
set %nicks $addtok(%nicks,$ialchan($banmask,$chan,%x).nick,32)
inc %x
}
else {
inc %x
}
}
if (%nicks == $null) { halt }
var %nicks = $replace(%nicks,$chr(32),$chr(44) $+ $chr(32))
echo -t $chan $iif($event = ban,$+($chr(3),7,Ban),$+($chr(3),7,Unban)) $&
of14 $banmask 07by14 $nick $+ ( $+ $remove($address($nick,1),*!*) $+ ) 07affects:14 %nicks $+ 07.
}