mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2004
Posts: 4
D
Dilpo Offline OP
Self-satisified door
OP Offline
Self-satisified door
D
Joined: Feb 2004
Posts: 4
Code:
 bmass {
  if ($me !ison $active) { error You must be on a channel. | return }
  if ($snick($chan,1) == $null) { error You must have at least one nickname selected. | return }
  if ($1 == $null) { return }
  if ($1 == ban) { if ($snick($chan,0) == 1) { ban $chan $snick($chan,1) 4 } | else { var %mass = 0 | :start | inc %mass 1 | if (%mass > $snick($chan,0)) { unset %mass | return } | if ($snick($chan,%mass) == $me) { goto start } | kick $chan $snick($chan,%mass) $2- | goto start } }
} 

I stripped down the alias to JUST have ban, for no reason should the use of this kick, ever, just set bans but for some reason if i have more than one nick selected it kicks all selected users, and doesnt set any bans. any help with this would be greatly appreciated

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
bmass { 
  var %c = $1
  tokenize 32 $2-
  if (!$0) { 
    var %i = 1
    while ($snick(%c,%i)) {
      ban -k %c $v1 2
      inc %i
    }
  }
  else { ban -k %c $* 2 }
}


/bmass <channel> [nick1] [nick2] [nick3] [etc]

If you don't specify any nickname then it uses the nicknames you have selected in <channel>.

Edit: if you don't want it to kick then just remove "-k" from the ban commands.

Last edited by tidy_trax; 01/01/05 11:09 AM.

New username: hixxy
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
As for youe original code, if you laid it out instead of using a bunch of pipes you can see...
[*] If you have one nick selected it [color:Olive]bans[/color]
[*] If you select multiple nicks, it [color:red]kicks[/color]
Code:
bmass {
  if ($me !ison $active) { error You must be on a channel. | return }
  if ($snick($chan,1) == $null) { error You must have at least one nickname selected. | return }
  if ($1 == $null) { return }
  if ($1 == ban) {
[color:green]    if ($snick($chan,0) == 1) { [color:Olive]ban[/color] $chan $snick($chan,1) 4 }[/color]
[color:#966363]    else {
      var %mass = 0
      :start
      inc %mass 1
      if (%mass &gt; $snick($chan,0)) { unset %mass | return }
      if ($snick($chan,%mass) == $me) { goto start }
      [color:red]kick[/color] $chan $snick($chan,%mass) $2-
      goto start
    }[/color]
  }
}

Using pipes gives very little benfit and can make code much harder to read|debug|alter|fix.


Link Copied to Clipboard