clear ban on channel banlist - 22/01/03 07:06 AM
help me, i need alias to unban all banmask on channel banlist.
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 } }
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
while %counter > 0 {
while %counter > 0 {
> is html for > ... (g)reater (t)han
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