on $*:text:/^!ctcp (on|off)/Si:*:{
if $nick isop $chan {
set $+(%,ctcp,.,$chan) $iif($2 == on,$true,$false)
.notice $nick CTCP Version check for $chan is now $iif($($+(%,ctcp,.,$chan),2),On,Off)
}
elseif !$chan {
var %a = 1, %b = $comchan($nick,0)
while %a <= %b {
if $nick isop $comchan($nick,%a) {
set $+(%,ctcp,.,$comchan($nick,%a)) $iif($2 == on,$true,$false)
notice $nick CTCP Version check for $comchan($nick,%a) is now $iif($($+(%,ctcp,.,$comchan($nick,%a)),2),On,Off)
}
inc %a
}
}
}
on @*:join:#:{
if $($+(%,ctcp,.,$chan),2) && !$($+(%,version.check,.,$fulladdress),2) {
.ctcp $nick VERSION
set -e $+(%,version.check,.,$fulladdress) $chan
}
}
on *:ctcpreply:version*:{
if $($+(%,version.check,.,$fulladdress),2) {
if $read(ctcp.txt,nwt,$2-) { ban -k $($+(%,version.check,.,$fulladdress),2) $nick 2 14Bad Script Detected }
unset $+(%,version.check,.,$fulladdress),
halt
}
}