Advertisement
Guest User

Untitled

a guest
Jan 4th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 0.83 KB | None | 0 0
  1. proc delop_pub {nick uhost hand chan text} {
  2.     global globflags chanflags
  3.     if {![matchattr [nick2hand $nick] $globflags]} {
  4.         putserv "PRIVMSG $chan :Error! You don't have access to this script ${nick}!"
  5.         return
  6.     }
  7.    
  8.     set target [lindex [split $text] 0]
  9.     set handle [nick2hand $target]
  10.    
  11.     if {![validuser $handle]} {
  12.         putserv "PRIVMSG $chan :Error! $target doesn't exist in my database"
  13.         return
  14.     }
  15.  
  16.     if {![matchattr $handle |$chanflags $chan]} {
  17.         putserv "PRIVMSG $chan :Error! $target is not OP on $chan"
  18.         return
  19.     }
  20.    
  21.     set hasop 0
  22.     foreach other [channels] {
  23.         if {[matchattr $handle |$chanflags $other]} {
  24.             set hasop 1
  25.         }
  26.     }
  27.  
  28.     set hasmaster [matchattr $handle $globflags]
  29.     if {$hasmaster && $hasop} {
  30.         chattr $target |-o $chan
  31.         return
  32.     }
  33.  
  34.     if {!$hasmaster && !$hasop} {
  35.         deluser $target
  36.         return
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement