mIRC Home    About    Download    Register    News    Help

Print Thread
$comchan #87788 22/06/04 09:11 AM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
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
    }
  }
}

Re: $comchan #87789 22/06/04 09:24 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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.


-KingTomato
Re: $comchan #87790 22/06/04 09:37 PM
Joined: Feb 2004
Posts: 119
D
da_hype Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Feb 2004
Posts: 119
.ban $comchan($2,%i) $nick

how do i make it work on active server/network?

Re: $comchan #87791 22/06/04 10:16 PM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
/scid $activecid <command>


-KingTomato