Clear-Chanlev Script for QuakeNet

From Scriptwiki
Revision as of 18:52, 23 August 2005 by BlackShroud (talk | contribs)

Jump to: navigation, search

Clear-Chanlev Script by Kickchon (for Q and L on QuakeNet) (v2.0) This script removes all known users on a #channel except owners or removes Q/L completely from #channel.

; # Clear-Chanlev Script by Kickchon (for Q and L on QuakeNet) (v2.0)
; # This script removes all known users on a #channel except owners or removes Q/L completely from #channel.
; # Please do nothing after typing /clearchanlev until you get a finish/error message.
;
; # Needs Owner Access on specified #channel and you have to be authed.
; # It will not remove other Owners.
;
; # Use /clearchanlev #channel or /clearchanlev #channel -remove if you want to remove Q/L from a channel.
;
; # Kickchon, staff member on Quakenet
;
; # If you think there's a bug in this Script, please contact someone in #help.script on Quakenet.

alias clearchanlev {
 if (!$1) {
   echo $color(info) -at *** Clear-Chanlev: You need to specify the channel.
 }
 elseif (Q !ison $1) && (L !ison $1) {
   echo $color(info) -at *** Clear-Chanlev: There is no Q or L bot on $1 $+ .
 }
 else {
   set %cc.what getlname
   set %cc.bot $iif(Q ison $1,Q,L)
   set %cc.chan $1
   if ($2 == -remove) { set %cc.remove $true }
   echo $color(info) -at *** Clear-Chanlev: Getting your %cc.bot $+ -Account Name.
   .enable #clearchanlev
   .msg %cc.bot whois $me
 }
}

#clearchanlev off

on ^*:NOTICE:*:*:{
 if ($nick == %cc.bot) {
   if (%cc.what == getlname) {
     if ($1 == $me) && ($3 == authed) {
       set %cc.account $left($5,-1)
     }
     if ($1- == End of list.) {
       if (%cc.account) {
         echo $color(info) -at *** Clear-Chanlev: Getting Userlist of %cc.chan $+ .
         set %cc.what getchanlev
         .msg %cc.bot chanlev %cc.chan
       }
       else {
         echo $color(info) -at *** Clear-Chanlev: You are not authed. Please auth before trying to clear a chanlev-list.
         unset %cc.*
         .disable #clearchanlev
       }
     }
   }
   elseif (%cc.what == getchanlev) {
     if ($1 != %cc.account) && (End of* !iswm $1-) && (Users for channel* !iswm $1-) && (Authname* !iswm $1-) && ($1- != $str(-,29)) && $&
       ($1 != Channeltype:) && (Known users* !iswm $1-) {
       if (n !isin $iif(%cc.bot == Q,$3,$2)) {
         write clearchanlev.txt CHANLEV %cc.chan # [ $+ [ $1 ] ] $iif(%cc.bot == Q,-amotv,-amovg)
       }
       elseif (n isin $iif(%cc.bot == Q,$3,$2)) {
         set %cc.noremove $true
       }
     }
     elseif ($1 == %cc.account) && (n !isin $iif(%cc.bot == Q,$3,$2)) {
       .remove "clearchanlev.txt"
       unset %cc.*
       .disable #clearchanlev
       echo $color(info) -at *** Clear-Chanlev: You are not the owner of that channel. Halting...
     }
     elseif (End* iswm $1-) {
       if (%cc.remove) {
         if (%cc.noremove) {
           echo $color(info) -at *** Clear-Chanlev: You may not remove %cc.bot $+ . You are not the only owner on %cc.chan $+ .
           .remove "clearchanlev.txt"
           unset %cc.*
           .disable #clearchanlev
           halt
         }
         else {
           write clearchanlev.txt CHANLEV %cc.chan # [ $+ [ %cc.account ] ] $iif(%cc.bot == Q,-amnotv,-amnovg)
         }
       }
       set %cc.what removeusers
       echo $color(info) -at *** Clear-Chanlev: There are $lines(clearchanlev.txt) Users to remove. It will take about $&
         $calc($lines(clearchanlev.txt)*2) seconds. Removing...
       .play %cc.bot clearchanlev.txt 2000
     }
   }
   haltdef
 }
}

on *:PLAYEND:{
 if ($nopath($filename) == clearchanlev.txt) {
   echo $color(info) -at *** Clear-Chanlev: Successfully Removed $iif(%cc.remove,$iif(%cc.bot == Q,Q,L) from,all Non-Owners on) %cc.chan $+ .
   if (!%cc.remove) { .msg %cc.bot chanlev %cc.chan }
   unset %cc.*
   .remove "clearchanlev.txt"
   .disable #clearchanlev
 }
}

#clearchanlev end