i couldnt find a script to do this so i gave it a shot and tried to make one myself
what i want the script to do is count the number of excess floods a user does and temp ban after 3 in less then a minute
my script does this but i cant seem to make it include the channel and evaluate the channel on the count tried a few things but they havent worked out
my script works but if the users on multiple channels they get combined in the count
heres my hacked up code that works except for parsing channel in checks
# part.tcl
# profers channel protection for mass parts with part message
### ....................................................................... ###
### .......... configuration (edit as required) ........................... ###
# set here the bot channels you want part flood protection in
set vPartChannels "#channel1 #channel2"
# set here the number of parts in how many seconds for the script to react
set vPartLimit 4:8
# set here the channel throttle (joins per seconds) when channel is restricted
set vPartJoins 3:3
# set here the time in minutes for the channel to remain restricted
set vPartTime 5
# set here the modes to set to restrict channel (excluding throttle mode j)
set vPartModes mMR
### ....................................................................... ###
### .......... code (do not edit) ......................................... ###
set vPartChannels [split [string tolower $vPartChannels]]
scan $vPartLimit {%d:%d} vPartNumber vPartSeconds
bind PART - * pPartBind
proc pPartBind {nick uhost hand chan msg} {
global vPartActive vPartChannels vPartData vPartJoins vPartModes vPartNumber vPartSeconds vPartTime
if {[lsearch -exact $vPartChannels [string tolower $chan]] != -1} {
if {![info exists vPartActive($chan)]} {set vPartActive($chan) 0}
if {!$vPartActive($chan)} {
if {[string length $msg] != 0} {
lappend vPartData($chan) [clock seconds]
set vPartData($chan) [lrange $vPartData($chan) end-[expr {$vPartNumber - 1}] end]
if {[llength $vPartData($chan)] == $vPartNumber} {
set period [expr {[lindex $vPartData($chan) end] - [lindex $vPartData($chan) 0]}]
if {$period <= $vPartSeconds} {
set vPartActive($chan) 1
putquick "MODE $chan +${vPartModes}j $vPartJoins"
timer $vPartTime [list pPartCancel $chan]
}
}
}
}
}
return 0
}
proc pPartCancel {chan} {
global vPartActive vPartModes
set vPartActive($chan) 0
putquick "MODE $chan -${vPartModes}j"
return 0
}
# eof
Sorry, I didn't mean to imply that simply changing xs_flooder to xs_flooder($chan) would suffice.
I was generalising when pointing the way to using an array variable rather than a normal scalar variable to store information in a per channel way. There would be one array element per channel you wished the code to function in.
What I perhaps failed to explain is that this would inevitably require other changes in the code.
As far as I can see, there is also nothing in your code to indicate which nick has previously done the flooding. The variable xs_flooder is simply incremented, resulting in the last nick to contribute getting banned.
To correct this, you would have to emulate a two dimensional array. Say something like xs_flooder($uhost,$chan). My code doesn't require this because I don't ban a user, rather I regulate a channel.
In any event I would advise that what you are trying to do is somewhat more difficult than your original code.