Clone ban script

By GrimReaper on Jun 14, 2010

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


Sign in to comment.
johnfm   -  Apr 14, 2011

if you dont mind give me the code which one kills the 1st nick when clone joins on server.

GrimReaper   -  Jun 19, 2010

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   -  Jun 19, 2010

I see. Thanks. =)

jaytea   -  Jun 19, 2010

er, it would be

$banmask iswm $ial($nick)

if anything :P but with $ialchan() you no longer need any if statements (or $iif), you can be sure it will return only nicks affected by the ban

Jethro   -  Jun 18, 2010

Yes, I suppose I should change it to:

$ialchan($banmask,#,\n).nick iswm $banmask
jaytea   -  Jun 18, 2010

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

Serpentsounds   -  Jun 17, 2010

The ^ enables you to halt default actions associated with that event. I just copy-pasted his script and kinda skipped over it. :P

And of course, there seems to be nothing $regsubex can't do, haha!

Jethro   -  Jun 15, 2010

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.

Serpentsounds   -  Jun 14, 2010

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.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.