mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
if I am an op in 4 channels and I wish to kick a user from all of them at the same time is there a better way than this?

Code:
alias kickall {

  if ($1 ison #chan1) { /kick $v2 $1 $2- }
  if ($1 ison #chan2) { /kick $v2 $1 $2- }
  if ($1 ison #chan3) { /kick $v2 $1 $2- }
  if ($1 ison #chan4) { /kick $v2 $1 $2- }

}

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
First, you aren't checking if the person is an op. Second, if you want it to kick on each channel the person is on, even if they aren't on all of them, then you do need to check each individually like you're doing. If you want to only kick if they are on all channels at once, then you can combine them.

That said, you *could* use a loop, but with only 4 channels, it really isn't any more efficient.

Code:
alias kickall {
  var %channels = #chan1 #chan2 #chan3 #chan4, %t = $numtok(%channels,32)
  while (%t) {
    if ($1 ison $gettok(%channels,%t,32)) { kick $v2 $1 $2- }
    dec %t
  }
}


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2007
Posts: 202
F
firefox Offline OP
Fjord artisan
OP Offline
Fjord artisan
F
Joined: Sep 2007
Posts: 202
ok thanks


Link Copied to Clipboard