mIRC Home    About    Download    Register    News    Help

Print Thread
#7780 22/01/03 07:06 AM
Joined: Dec 2002
Posts: 76
A
Babel fish
OP Offline
Babel fish
A
Joined: Dec 2002
Posts: 76
help me, i need alias to unban all banmask on channel banlist.

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
/unbanall #channel

Code:
alias unbanall {
  if ( !$chan($$1).ibl ) {
    set %getbans $+ $1 1
    mode $1 +b
  }
  else {
    var %uba = 1
    while ( $ibl($$1,%uba) != $null ) {
      mode $1 -b $ibl($1,%uba)
      inc %uba
    }
  }
}
raw 367:*:{
  if ( $eval(% $+ getbans $+ $$2,2) == 1 ) {
    halt
  }
}
raw 368:*:{
  if ( $eval(% $+ getbans $+ $$2,2) == 1 ) {
    unbanall $2
    unset $eval(% $+ getbans $+ $2)
    halt
  }
}

Joined: Dec 2002
Posts: 76
A
Babel fish
OP Offline
Babel fish
A
Joined: Dec 2002
Posts: 76
thanks !!!

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Although Collective's script would work fine, here's a similar code, which wipes as much bans as possible in one /mode command.
Code:
alias clearbans {
  if $me !isop $1 {
    return
  }
  if $chan($1).ibl == $false {
    ;
    ; If mIRC hasn't seen the channel bans list, it must do a /mode +b
    ; before attemting to remove bans it doesn't know about.
    ;
    ; We'll be back at the end of the ban list (raw 368)
    ;
    .enable #banlist
    mode $1 +b
    return
  }
  ;
  ; We initialize the %counter variable with the value of
  ; total number of active bans.
  ;
  ; Then we'll decrease it by one every time the loop runs
  ; until it reaches zero then the loop stops.
  ;
  var %counter = $ibl($1,0)
  while %counter > 0 {
    ;
    ; %buffer will keep a short list of bans, which should be
    ; lifted in one command, as much bans as the server allows.
    ;
    ; In this way, mIRC will not send a separate /mode command
    ; for each ban. it will take a few together.
    ;
    var %buffer = %buffer $ibl($1,%counter), %counter = %counter - 1
    ;
    ; If total number of buffered bans equals to the server mode limit,
    ; or - the buffer equals to zero (ie. no more bans left in the list),
    ; we perform a /mode command and then clear the %buffer.
    ;
    if $numtok(%buffer,32) == $modespl || %counter == 0 {
      mode $1 - $+ $str(b,$ifmatch) %buffer
      unset %buffer
    }
  }
}

#banlist off
raw 367:*:haltdef
raw 368:*:haltdef | .disable #banlist | clearbans $2
#banlist end

Joined: Dec 2019
Posts: 20
S
Ameglian cow
Offline
Ameglian cow
S
Joined: Dec 2019
Posts: 20
Hi, I realize this is a way old script but I liked how its setup only getting a error I am sure from a old option that is no longer valid,
Is there a work around

* /while: ' & g t ; ' unknown operator (line 24, clearbans.ini)
(added spaces to hopefully get it to display the op)



Last edited by Stephen; 26/01/20 02:05 AM. Reason: (added spaces to hopefully get it to display the op)
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
This is a webpage parsing error. Any time you see a character sequence beginning with "&" and ending with semi-colon, there's a good chance that it's html markup. It shows as

while %counter > 0 {

and should be

while %counter > 0 {

and preferably without trying to scrimp on using parenthesis:

while (%counter > 0) {

Joined: Feb 2011
Posts: 448
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 448
Replace this line:
Code
  while %counter > 0 {

with:
Code
  while %counter > 0 {


Code
&gt is html for >  ... (g)reater (t)han 

Joined: Jul 2014
Posts: 308
Pan-dimensional mouse
Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 308
Originally Posted by aZnLupin
help me, i need alias to unban all banmask on channel banlist.

/clearbans #channel

I created the code for you and I hope it helps. I tested it on 2 networks with different $modespl and I think it's working wink

Code
alias clearbans {
  if ($me isop $1) {
    if ($chan($1).ibl == $false) {
      .enable #banlist
      mode $1 +b
      return
    }
    var %x = 1 , %y = $ibl($1,0), %n
    while (%x <= %y) {
      var %n = $addtok(%n,$ibl($1,%x),32)
      inc %x
    }
    while ($numtok(%n,32)) {
      mode $1 - $+ $str(b,$numtok($gettok(%n,1- $+ $modespl,32),32)) $gettok(%n,1- $+ $modespl,32)
      var %n = $deltok(%n,1- $+ $modespl,32)
    }
  }
}
#banlist off
raw 367:*:{ haltdef }
raw 368:*:{
  haltdef
  .disable #banlist
  clearbans $2
}
#banlist end

Last edited by TECO; 26/01/20 11:26 PM.

TECO
irc.PTirc.org (Co-Admin)

Link Copied to Clipboard