This is a little snippet I was asked to make on the iPocalyse network by Netadmin Eric.
What it will do is search the channel after a ban for ANY clone's and kick them as well as the secondary user and so on.
Just change #CHANNEL for the channel you wish to use the script with.
on ^*:BAN:#CHANNEL: {
var %bannum = 1
while (%bannum <= $nick($chan,0)) {
if ($address($nick($chan,%bannum),2) != $banmask) { inc %bannum }
else {
kick $chan $nick($chan,%bannum) You have been banned
inc %bannum
}
}
}
That's for all the comment's guys, I generally make script's to how /I/ know they would work. I didn't know what the ^ ment but now I do.
I just made this script by looking at previous script's I have in my mIRC as I don't usually make script's that use the on *:BAN.
I will take all your comment's into mind for next time. :)
Jethro_ i think you'll find the novelty of $regsubex() will soon wear off :P
and we should really be checking if each nick's type 5 mask (the full address) is matched by $banmask, as $banmask could be something other than a type 2 mask. mirc does this checking for us in $ialchan($banmask,#,N).nick which returns the Nth nick affected by the ban
You can do it with regsubex:
on @*:ban:#:{
tokenize 32 $regsubex($str(.,$nick(#,0)),$&
/./g,$iif($address($nick(#,\n),2) = $banmask,$&
$nick(#,\n)) $chr(32)) | kick # $* You have been banned!
}
I don't get why the author used ^ next to his ban event. The ^ indicates it's a custom event, where the script it's not considered one. ^ serves no purpose in this case.
Not bad, a couple things to keep in my mind for future endeavors:
on ^*:BAN:#CHANNEL:{
var %bannum 1
while ($nick($chan,%bannum)) {
if ($address($v1,2) == $banmask) kick $chan $nick($chan,%bannum) You have been banned
inc %bannum
}
}
Rather than doing while (%bannum <= $nick($chan,0)), you can use the change shown to achieve the same result and even quickly access the result with the $v1 identifier. Since you have 'inc %bannum' in both blocks of logic, you can improve efficiency and readability by switching the logic around to only place it where required.
Not saying that anything you did was wrong in any way, but suggestions have always helped me.