mIRC Homepage
Posted By: da_hype $comchan - 22/06/04 09:11 AM
any one know why this don't work? frown

Code:
;/_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) && ($2 ison $comchan($nick,%i)) { .ban $comchan($2,%i) $nick }
      inc %i
    }
  }
  if (k isin $1) {
    var %i = 1 
    while ($comchan($2,%i)) {
      if ($comchan($2,%i).op) && ($2 ison $comchan($nick,%i)) { .kick $comchan($2,%i) $nick $iif(!$3,$3) }
      inc %i
    }
  }
}
Posted By: KingTomato Re: $comchan - 22/06/04 09:24 AM
this should work now:

Code:
;/_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.
Posted By: da_hype Re: $comchan - 22/06/04 09:37 PM
.ban $comchan($2,%i) $nick

how do i make it work on active server/network?
Posted By: KingTomato Re: $comchan - 22/06/04 10:16 PM
/scid $activecid <command>
© mIRC Discussion Forums