Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 15.60 KB | None | 0 0
  1. # --------------------------------------------------------------------
  2. # Commands
  3. # --------------------------------------------------------------------
  4. # Support Commands:
  5. #   --> .next [x]        = voices next (x) user(s) in list
  6. #   --> .done <nick>     = removes voice from <nick>
  7. #   --> .list              = notices you the list
  8. #   --> .noidle <nick>     = kickbans <nick> for idling
  9. #   --> .clearlist         = clear the list
  10. #   --> .getlist           = rebuild the list with non opped/voiced users
  11. # Admin Commands:
  12. #   --> .on                = turn script on
  13. #   --> .off               = turn script off
  14.  
  15. # --------------------------------------------------------------------
  16. # VARIABLES
  17. # you have to change these
  18. # --------------------------------------------------------------------
  19.  
  20.     # The channel you will use this:
  21. set next(chan) "#bf-support"
  22.     # the char that marks public commands (.next, etc...)
  23. set next(char) "!"
  24.     # topics ... k you can add as many topics as you want, just call the others next(topic3) next(topic4) ...
  25.     # note: be carefull with special signs like [ ] " & ...
  26. #set next(topic1) "14.::[ 4Willkommen im #BF-support Channel 14|| 4Wartet auf Voice! Auch wenn es mal länger dauert 14|| 4Kein idlen! 14|| 4Keine ungefragten Querys!14 || 4Nennt uns zuerst euren Trackernick! 14] 8>> 12Ein gebannter Account wegen Cheatens ist unwiderruflich deaktiviert 8<<10"
  27. #set next(topic2) "14.::[ 4Willkommen im #BF-support Channel 14|| 4Wartet auf Voice! Auch wenn es mal länger dauert 14|| 4Kein idlen! 14|| 4Keine ungefragten Querys!14 || 4Nennt uns zuerst euren Trackernick! 14] 8>> 12Ein gebannter Account wegen Cheatens ist unwiderruflich deaktiviert 8<<10"
  28.     # noidle ban type: (code based on on Moretools.tcl by MC_8)
  29.     #  0 = *!user@host.domain
  30.     #  1 = *!*user@host.domain
  31.     #  2 = *!*@host.domain
  32.     #  3 = *!*user@*.domain
  33.     #  4 = *!*@*.domain
  34.     #  5 = nick!user@host.domain
  35.     #  6 = nick!*user@host.domain
  36.     #  7 = nick!*@host.domain
  37.     #  8 = nick!*user@*.domain
  38.     #  9 = nick!*@*.domain
  39.     # 10 = regular eggdrop mask
  40. set next(bantype) "1"
  41.     # noidle kick message
  42. set next(noidle) "10Dies ist ein Support-Channel... 4DON'T IDLE!!!"
  43.     # noidle bantime
  44. set next(bantime) "1"
  45.     # automatic rebuild the voice list with the non opped/voiced
  46.     # users on the channel after a rehash? (1/0)
  47. set next(rehash) "1"
  48.  
  49.  
  50. # --------------------------------------------------------------------
  51. # MAGIC BORDER
  52. # Don't cross this line unless you feel prepared to code
  53. # --------------------------------------------------------------------
  54. set next(list) {}
  55. set next(chan) [string tolower $next(chan)]
  56. set next(version) "v2.2"
  57. set next(status) "on"
  58. set next(num2name) "none Trainee {Regular Helper} {Channel Op} Admin Owner"
  59.  
  60.  
  61. # --------------------------------------------------------------------
  62. # mode handlers
  63. # --------------------------------------------------------------------
  64. #### join / rejoin
  65. proc next.add {nick uhost handle chan} {
  66.     global botnick next
  67.     if {$nick == $botnick || [string tolower $chan] != $next(chan) || [matchattr $handle g|g $next(chan)]} { return }
  68.     lappend next(list) $nick
  69.     set num [lsearch -exact $next(list) $nick]
  70.     incr num
  71.     putserv "NOTICE $nick :4Bitte warte bis du an der Reihe bist. Du bist Nummer 12$num 4in der Warteliste... Danke!"
  72. }
  73. #### part & sign
  74. proc next.purge {nick uhost handle chan msg} {
  75.     global botnick next
  76.     if {$nick == $botnick || [string tolower $chan] != $next(chan) || [matchattr $handle g|g $next(chan)]} { return }
  77.     set index [lsearch -exact $next(list) $nick]
  78.     if {$index >= 0} {
  79.     set next(list) [lreplace $next(list) $index $index ]
  80.     } else { return }
  81. }
  82. #### nick
  83. proc next.replace {nick uhost handle chan newnick} {
  84.     global botnick next
  85.     if {$nick == $botnick || [string tolower $chan] != $next(chan) || [matchattr $handle g|g $next(chan)]} { return }
  86.     set index [lsearch -exact $next(list) $nick]
  87.     if {$index >= 0} {
  88.     set next(list) [lreplace $next(list) $index $index $newnick]
  89.     } else { return }
  90. }
  91. #### kick
  92. proc next.kick {nick uhost handle chan vict reason} {
  93.     global botnick next
  94.     if {$vict == $botnick || [string tolower $chan] != $next(chan) || [matchattr [nick2hand $vict $next(chan)] g|g $next(chan)]} { return }
  95.     set index [lsearch -exact $next(list) $vict]
  96.     set next(list) [lreplace $next(list) $index $index ]
  97. }
  98. #### split
  99. proc next.splt {nick uhost handle chan} {
  100.     global botnick next
  101.     if {$nick == $botnick || [string tolower $chan] != $next(chan) || [matchattr $handle g|g $next(chan)]} { return }
  102.     set index [lsearch -exact $next(list) $nick]
  103.     set next(list) [lreplace $next(list) $index $index ]
  104. }
  105. #### voiced / opped
  106. proc next.voiced {nick host hand chan mdechg dnick} {
  107.     global botnick next
  108.     if {[string tolower $chan] == $next(chan) && $dnick != $botnick} {
  109.     set index [lsearch -exact $next(list) $dnick]
  110.     set next(list) [lreplace $next(list) $index $index ]
  111.     } else { return }
  112. }
  113. #### rehash
  114. proc next.rehash {type} {
  115.     global botnick next
  116.     if {$next(rehash) && [botonchan $next(chan)]} {
  117.     set llength [llength $next(list)]
  118.     foreach user [chanlist $next(chan)] {
  119.         if {![isvoice $user $next(chan)] && ![isop $user $next(chan)] && [onchan $user $next(chan)] && $user != $botnick && ![matchattr [nick2hand $user $next(chan)] g $next(chan)]} {
  120.             set index [lsearch -exact $next(list) [lindex $user 0]]
  121.             if {$index < 0} {
  122.             set next(list) [linsert $next(list) $llength $user ]
  123.             }
  124.         }
  125.     }
  126.     }
  127. }
  128. # --------------------------------------------------------------------
  129. # Regular command handlers
  130. # --------------------------------------------------------------------
  131. #### next
  132. proc next.pub:voice {nick uhost handle chan arg} {
  133.     global next
  134.     if {[string tolower $chan] != $next(chan)} { return 0 } {
  135.     if {$next(list) == ""} { putserv "NOTICE $nick :List is empty." ; return }
  136.     if {[botisop $chan]} {
  137.       set num [lindex [split $arg] 0]
  138.       if {$num != "" && [string is integer $num]} {
  139.         for { set i 0 } { $i < $num } { incr i } {
  140.         if {$next(list) == ""} { break }
  141.         set voice [lindex $next(list) 0]
  142.         putserv "MODE $chan +v $voice"
  143.         set index [lsearch -exact $next(list) $voice]
  144.         set next(list) [lreplace $next(list) $index $index ]
  145.         putserv "NOTICE $voice :So, du bist der nächste im $next(chan) , bitte stelle jetzt deine Frage!"
  146.         }
  147.       } else {
  148.         set voice [lindex $next(list) 0]
  149.         putserv "MODE $chan +v $voice"
  150.         set index [lsearch -exact $next(list) $voice]
  151.         set next(list) [lreplace $next(list) $index $index ]
  152.         putserv "PRIVMSG $chan :$voice: 12Stelle deine Frage bitte jetzt... 10Dir wird geholfen von: 4$nick"
  153.       }
  154.     return }
  155.     putserv "NOTICE $nick :I can't do my job cos I'm not oped on $chan."
  156.     return
  157.     }
  158. }
  159. #### done
  160. proc next.pub:done {nick uhost handle chan arg} {
  161.     global botnick next
  162.     if {[string tolower $chan] != $next(chan)} { return 0 } {
  163.     if {[botisop $chan] && [isvoice [lindex [split $arg] 0] $chan]} {
  164.     putserv "MODE $chan -v :[lindex [split $arg] 0]"
  165.     putserv "PRIVMSG $chan [lindex [split $arg] 0]10 dein Support ist nun beendet... Bitte verlasse jetzt diesen Channel 10- 4don't idle!"
  166.     return }
  167.     }
  168. }
  169. #### noidle ####
  170. proc next.pub:noidle {nick uhost handle chan arg} {
  171.     global botnick botname next
  172.     if {[string tolower $chan] != $next(chan)} { return 0 } {
  173.     if {[lindex [split $arg] 0] == ""} {putserv "NOTICE $nick :Usage: !noidle <nick>"
  174.     return}
  175.     if {[onchan [lindex [split $arg] 0] $next(chan)]} {set index [lsearch -exact $next(list) [lindex [split $arg] 0]]
  176.     if {$index >= 0} {
  177.     set next(list) [lreplace $next(list) $index $index ]
  178.     }
  179.         switch $next(bantype) {
  180.           0 {set ban "*![string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
  181.           1 {set ban "*!*[string trimleft [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] e] "~"]"}
  182.           2 {set ban "*!*[string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first @ [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
  183.           3 {set ident [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] [expr [string last @ [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "*!*[string trimleft $ident "~"][string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string first @ [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
  184.           4 {set ban "*!*[string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string last "@" [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
  185.           5 {set ban "[lindex [split $arg] 0]![string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first ! [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
  186.           6 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ident [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] [expr [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string trimleft $ident "~"][string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
  187.           7 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
  188.           8 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ident [string range [getchanhost [lindex [split $arg] 0] $next(chan)] [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]+1] [expr [string last "@" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string trimleft $ident "~"][string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string last "@" [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
  189.           9 {set nick [string range [getchanhost [lindex [split $arg] 0] $next(chan)] 0 [expr [string first "!" [getchanhost [lindex [split $arg] 0] $next(chan)]]-1]] ; set ban "[lindex [split $arg] 0]!*[string range [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]] [string last "@" [maskhost [getchanhost [lindex [split $arg] 0] $next(chan)]]] e]"}
  190.           default {set ban "*!*[string range [getchanhost [lindex [split $arg] 0] $next(chan)] [string first "@" [getchanhost [lindex [split $arg] 0] $next(chan)]] e]"}
  191.         }
  192.         set nnick [lindex [split $ban !] 0]
  193.         set iident [string range $ban [expr [string first ! $ban]+1] [expr [string last @ $ban]-1]]
  194.         set hhost [string range $ban [expr [string last @ $ban]+1] e]
  195.         if {$iident != [set temp [string range $iident [expr [string length $iident]-9] e]]} {set iident *[string trimleft $temp *]}
  196.         if {$hhost != [set temp [string range $hhost [expr [string length $hhost]-63] e]]} {set hhost *[string trimleft $temp *]}
  197.         set next(ban) "$nnick!$iident@$hhost"
  198.     if {[string match "$next(ban)" "$botname"]} {putserv "NOTICE $nick :The ban ( $next(ban) ) matches me ..."
  199.     return }
  200.     newchanban $next(chan) $next(ban) $nick "$next(noidle)" $next(bantime)
  201.     pushmode $chan -o [lindex [split $arg] 0]
  202.     pushmode $chan +b $next(ban)
  203.     putkick $chan [lindex [split $arg] 0] "$next(noidle)"
  204.     return }
  205.     putserv "NOTICE $nick :[lindex [split $arg] 0] isn't on $next(chan)"
  206.     return }
  207. }
  208. #### list
  209. proc next.pub:list {nick uhost handle chan arg} {
  210.     global next
  211.     if {[string tolower $chan] != $next(chan)} { return 0 }  {
  212.     if {$next(list) == ""} { putserv "NOTICE $nick :Voice list is curently empty."
  213.     return }
  214.     putserv "NOTICE $nick :\002List\002: $next(list)"; return
  215.     }
  216. }
  217. #### getlist
  218. proc next.pub:getlist {nick uhost handle chan arg} {
  219.     global botnick next
  220.     if {[string tolower $chan] != $next(chan)} { return 0 } {
  221.     set llength [llength $next(list)]
  222.     foreach user [chanlist $chan] {
  223.         if {![isvoice $user $chan] && ![isop $user $chan] && [onchan $user $chan] && $user != $botnick && ![matchattr [nick2hand $nick $chan] o]} {
  224.             set index [lsearch -exact $next(list) [lindex $user 0]]
  225.             if {$index < 0} {
  226.             set next(list) [linsert $next(list) $llength $user ]
  227.             }
  228.         }
  229.     }
  230.     if {$next(list) == ""} { putserv "NOTICE $nick :No users added to voice list. Voice list is empty"
  231.     } else {
  232.     putserv "NOTICE $nick :\002getlist copmleted\002. ( $next(list) )"
  233.     }
  234.     return
  235.     }
  236. }
  237. #### clearlist
  238. proc next.pub:clearlist {nick uhost handle chan arg} {
  239.     global botnick next
  240.     if {[string tolower $chan] != $next(chan)} { return 0 } {
  241.         if {[llength $next(list)] == "0"} {
  242.         putserv "NOTICE $nick :Voice list is allready empty. No users to remove."
  243.         return
  244.         } else {
  245.         set next(list) {}
  246.         putserv "NOTICE $nick :Cleared. Voice list is empty."
  247.         return
  248.         }
  249.     }
  250. }
  251. # --------------------------------------------------------------------
  252. # Admin command handlers
  253. # --------------------------------------------------------------------
  254. bind pub m|m ${next(char)}on next.pub:on
  255. bind pub m|m ${next(char)}off next.pub:off
  256. #### on
  257. proc next.pub:on {nick uhost handle chan arg} {
  258. global next botnick
  259.     if {$next(status) == "on"} {
  260.         putserv "NOTICE $nick :.next $next(version) is allready on!"
  261.     } else {
  262.         next.status on
  263.         putserv "NOTICE $nick :.next $next(version) is now on!"
  264.         set next(status) "on"
  265.     }
  266. }
  267. #### off
  268. proc next.pub:off {nick uhost handle chan arg} {
  269. global next botnick
  270.     if {$next(status) == "off"} {
  271.         putserv "NOTICE $nick :.next $next(version) is allready off!"
  272.     } else {
  273.         next.status off
  274.         putserv "NOTICE $nick :.next $next(version) is now off!"
  275.         set next(status) "off"
  276.     }
  277. }
  278.  
  279. proc next.status {arg} {
  280. global next
  281.   switch $arg {
  282.     on {
  283.         bind join - * next.add
  284.         bind rejn - * next.add
  285.         bind part - * next.purge
  286.         bind sign - * next.purge
  287.         bind nick - * next.replace
  288.         bind kick - * next.kick
  289.         bind splt - * next.splt
  290.         bind mode - *+v* next.voiced
  291.         bind mode - *+o* next.voiced
  292.         bind evnt - rehash next.rehash
  293.  
  294.         bind pub f ${next(char)}next next.pub:voice
  295.         bind pub f ${next(char)}done next.pub:done
  296.         bind pub f ${next(char)}list next.pub:list
  297.         bind pub f ${next(char)}noidle next.pub:noidle
  298.         bind pub f ${next(char)}clearlist next.pub:clearlist
  299.         bind pub f ${next(char)}getlist next.pub:getlist
  300.     return 1}
  301.     off {
  302.         catch { unbind join - * next.add }
  303.         catch { unbind rejn - * next.add }
  304.         catch { unbind part - * next.purge }
  305.         catch { unbind sign - * next.purge }
  306.         catch { unbind nick - * next.replace }
  307.         catch { unbind kick - * next.kick }
  308.         catch { unbind splt - * next.splt }
  309.         catch { unbind mode - *+v* next.voiced }
  310.         catch { unbind mode - *+o* next.voiced }
  311.         catch { unbind evnt - rehash next.rehash }
  312.  
  313.         catch { unbind pub f ${next(char)}next next.pub:voice }
  314.         catch { unbind pub f ${next(char)}done next.pub:done }
  315.         catch { unbind pub f ${next(char)}list next.pub:list }
  316.         catch { unbind pub f ${next(char)}noidle next.pub:noidle }
  317.         catch { unbind pub f ${next(char)}clearlist next.pub:clearlist }
  318.         catch { unbind pub f ${next(char)}getlist next.pub:getlist }
  319.     return 1}
  320.   }
  321. }
  322.  
  323. # --------------------------------------------------------------------
  324. # the end
  325. # --------------------------------------------------------------------
  326. next.status on
  327. putlog ".next $next(version) by Thanatos loaded ..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement