this should work now:
;/_comchan [+bk] <nick> [msg]
;com channel kick
; +b flag is used to ban
; +k flag is used to kick
_comchan {
if (b isin $1) {
var %i = 1
while ($comchan($$2,%i)) {
if ($comchan($2,%i).op) .ban $comchan($2,%i) $2
inc %i
}
}
if (k isin $1) {
var %i = 1
while ($comchan($$2,%i)) {
if ($comchan($2,%i).op) .kick $comchan($2,%i) $2 $3
inc %i
}
}
}
(Copy to wordpad (Start>>Run "wordpad") first, then to mirc to keep formatting)
And just as a learning experience, i want to point out a couple things. First off the below check is not needed:
($2 ison $comchan($nick,%i))
This is simple because comchan wouldn't report a channel they weren't on ;d Also, the real problem was you used $nick not $2 in both commands:
if ($comchan($2,%i).op) && ($2 ison $comchan($nick,%i)) { .ban $comchan($2,%i)
$nick }
if ($comchan($2,%i).op) && ($2 ison $comchan($nick,%i)) { .kick $comchan($2,%i)
$nick $iif(!$3,$3) }
Also, you don't need to use the $iif if you aren't going to provide an alternate when it's absent. Just use $3. If its there, it's there. If no, oh well.