Guest User

Untitled

a guest
Dec 10th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 1.87 KB | None | 0 0
  1.  
  2. bind pubm - "*" check_caps
  3.  
  4. set chanpro(caps_percent) 70
  5. set chanpro(caps_minimum) 10
  6. set chanpro(caps) 1
  7.  
  8. proc check_caps {nick host hand chan text} {
  9.  
  10. set caps 0
  11. set total_string [expr [string length $text] - [regsub -all -- " " $text * *]]
  12.  
  13. global chanpro
  14.  
  15. #check if CAPS-check is disabled, if so - return
  16.  if {!$chanpro(caps)} {return 0}
  17.  
  18. #Prüfen wie viele Buchstaben Groß sind
  19.  foreach char [split $text ""] {
  20.     if {[string match *$char* "ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ"]} {incr caps}
  21.   }
  22.  
  23.  #Prüfen wie viel % Gro geschrieben sind
  24.  if {$caps == 0 || $total_string == 0} {return 0}
  25.  set percent [expr $caps.0 / $total_string * 100]
  26.  
  27.  #Prüfen ob die %-Großgeschriebener Buchstaben größer ist als die Max-%-Zahl für Caps.
  28.  if {$percent < $chanpro(caps_percent) || $total_string < $chanpro(caps_minimum)} {return 0}
  29.  set percent [expr $caps.0 / $total_string * 100]
  30.  
  31.   #Prüfen ob die %-Großgeschriebener Buchstaben größer ist als die Max-%-Zahl für Caps.
  32.  if {$percent < $chanpro(caps_percent) || $total_string < $chanpro(caps_minimum)} {return 0}
  33.  
  34.  #Prüft ob der User ein Op ist.
  35.  # if {[isop $nick $chan]} {
  36.        # return 0
  37.  # }
  38.  
  39.  #Sendet das Ergebnis zum Kick-proc weiter...
  40.  actions $nick $host $chan "caps"
  41. }
  42.  
  43. #Kick/timeout
  44. proc actions {nick host chan what} {
  45.  
  46.  
  47.  
  48.  
  49. if {[info exists user($nick)]} { incr user($nick)
  50.     } else {
  51.     set user($nick) 0
  52.     }
  53.  
  54.  
  55. set kick 1
  56. set caps(1) 2*60
  57. set caps(2) 4*60
  58. set caps(3) 6*60
  59.  
  60. puthelp "privmsg $chan : $user($nick)"
  61.  
  62.  
  63. if {$user($nick) == 1} {
  64.         puthelp "privmsg $chan :.timeout $nick $kick"
  65.       }
  66.      
  67. if {$user($nick) == 2} {
  68.         puthelp "privmsg $chan :.timeout $caps(1)"
  69.       }
  70.      
  71. if {$user($nick) == 3} {
  72.         puthelp "privmsg $chan :.timeout $caps(2)"
  73.       }
  74.      
  75. if {$user($nick) >= 4} {
  76.         puthelp "privmsg $chan :.timeout $caps(3)"
  77.       }
  78. }
Add Comment
Please, Sign In to add comment