#########################################
# capsGF.tcl (GF stands for G-Force bot)
# credits goes to:
# ppslim, Papillon
#
#Date: 11 sept 2002
#
#########################################
#
#Set this to the minimum string wize, before it will act
#IE, set 6, "HELLO" = no kick, "HELLO ALL" = kick
set cap_min 5
#set this tot he percentage, wihtout any percentage char
#IE, 50
set cap_per 40
bind pubm - "*" cap:perc:kick
proc cap:perc:kick {nick uh hand chan arg} {
global cap_per cap_min
if {[string length $arg] <= $cap_min} { return }
set full [string length $arg]
regsub -all {[A-Z]} $arg "" arg
putlog "$arg"
set perc [expr (($full - [string length $arg]) * 100) / $full]
putlog "$perc"
if {$perc >= $cap_per} {
putserv "KICK $chan $nick :*** NO *** caps please!!!) ([string range $perc 0 5]% caps)"
}
}
putlog "CapsGF.tcl 2002 Loaded"
--------------------------------------------------
I give all the credits to ppslim and Pappillon
many tnx for your help
# use .chanset #yourchan <channel setting name> <min length>:<max percent>
# the name of your channel setting:
set capskick CAPSKICK;
setudef str $capskick
bind pubm - * capskick
proc capskick {n u h c a} {
if {[scan [channel get $c $::capskick] %d:%d m p]!=2} return
if {[set t [string len $a]]<$m} return
set P [expr ([regexp -all {[A-Z]} $a]/$t.)*100]
if {$P>=$p} {
putkick $c $n "A-Z: [format %.1f $P]%"
}
}
EDIT: fixed a bug and added the percent to the kick message
EDIT2: fixed the bug i introduced when fixing the other bug
(not tested as usual )
EDIT3: testing might not be such a bad idea after all... (rounding bug)
Last edited by user on Sat Jan 22, 2005 8:57 pm, edited 3 times in total.
dont want to act up but... it seems to be a whole new script thx how to display the values (like % caps) in the kickmessage also ?
ok, i tried it with a simple thing
10 x a's
when i use
aaaaaaaaaa it doesnt do anything (wich is normal)
when i do
Aaaaaaaaaa it kicks already, while i've set 5:50
basicly it just kicks when i talk in the channel
anyway isnt it better to add to the previous script ? (the channel awareness) i tested that and it works good
dont want to act up but... it seems to be a whole new script thx how to display the values (like % caps) in the kickmessage also ?
ok, i tried it with a simple thing
10 x a's
when i use
aaaaaaaaaa it doesnt do anything (wich is normal)
when i do
Aaaaaaaaaa it kicks already, while i've set 5:50
basicly it just kicks when i talk in the channel
anyway isnt it better to add to the previous script ? (the channel awareness) i tested that and it works good
Here's the one I use, quite similar to the one posted in this topic.
# Set the channels here where you wish the kick to be activated on.
set capschans "#india #bharat"
#Set this to the minimum text size, before it will act
set capsmin "70"
# Minimum percentage of CAPS detected from the full text
set capslen "65"
bind pubm - * pub:caps:kick
proc pub:caps:kick {nick uhost hand chan text} {
global botnick capschans capsmin capslen
if {[string length $text] < $capsmin} {return 0}
set text [ctrl:filter $text]
set maxcaps "[string length $text]"
regsub -all {[A-Z]} $text "" counted
set countcaps [string length $counted]
set capsban "*!*@[lindex [split $uhost @] 1]"
set capsper [expr (($maxcaps - $countcaps) * 100) / $maxcaps]
if {(([lsearch -exact [string tolower $capschans] [string tolower $chan]] != -1) || ($capschans == "*"))} {
if {([botisop $chan]) && (![isop $nick $chan]) && (![isvoice $nick $chan]) && (![matchattr $hand mn|mn $chan]) && ([onchan $nick $chan]) && ($capsper >= $capslen)} {
set capsrange "[string range $capsper 0 end]%"
putquick "MODE $chan +b $capsban"
putquick "KICK $chan $nick :0,1 Excessive CAPS Text Kick 12,0 - 12Exceeded the limit of2 $capslen% percent 12of caps by typing2 *$maxcaps* capital characters, 12at a rate of2 $capsrange percent. 12Please turn *off* your 2caps lock switch, 12which is located 2left to the 'A' button 12on your keyboard."
timer 30 "pushmode $chan -b $capsban"
return 0
}
}
}
proc ctrl:filter {str} {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str
return $str
}
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee) PS: Guys, I don't accept script helps or requests personally anymore.
==================================