tcl
##### DEBUT DU PROGRAMME #####
bind time - "* * * * *" limit:time:check
bind join - "*" limit:join
bind part - "*" limit:part
proc limit:join {nick handle host chan} {
limit:time:check 0 0 0 0 0
}
proc limit:part {nick handle host chan {msg ""}} {
limit:time:check 0 0 0 0 0
}
proc limit:time:check { min hour day month year } {
global limit
set limite_actuelle 5
foreach chan [channels] {
if {(($limit(channel) != "all") && ([lsearch -exact $limit(channel) $chan] != -1)) || ($limit(channel) == "all")} {
if {[string match *l* [lindex [getchanmode $chan] 0]]} {
if {[string match *k* [lindex [getchanmode $chan] 0]]} {
set limite_actuelle [lindex [getchanmode $chan] 2]
} else {
set limite_actuelle [lindex [getchanmode $chan] 1]
}
}
if {![info exists limit($chan,stop)]} {
set limit($chan,stop) 0
}
set limit($chan,total) [llength [chanlist $chan]]
if {![info exists limit($chan,total,old)]} {
set limit($chan,total,old) $limit($chan,total)
}
# on regarde si y'a pas trop de gens qui sont rentrés sur le channel en 1 minute
if {![info exists limit($chan,danger)]} {
set limit($chan,danger) 1
}
if {$limit($chan,total) == [expr $limit($chan,total,old) + $limit(plus)]} {
if {![info exists limit($chan,danger,moment)]} {
set limit($chan,danger,moment) "$hour:$min"
}
if {([lindex [split $limit($chan,danger,moment) :] 0] == $hour) && ([expr [lindex [split $limit($chan,danger,moment) :] 1] + 1] == $min)} {
# si la limite était pleine il y a une minute deja alors on incremente le danger
set limit($chan,danger) [expr $limit($chan,danger) + 1]
}
}
if {$limit($chan,danger) == 2} {
putlog "#LIMIT# Je trouve qu'il y a bcp de personne qui ont rejoin $chan ... je n'augmente plus la limite pendant X secondes !"
puthelp "privmsg $chan :#LIMIT# Je trouve qu'il y a bcp de personne qui ont rejoin $chan ... je n'augmente plus la limite pendant X secondes !"
set limit($chan,stop) 4
set limit($chan,danger) 1
} else {
if {$limit($chan,stop) > 0} {
set limit($chan,stop) [expr $limit($chan,stop) - 1]
} else {
if {$limit($chan,danger) < 2} {
if {$limite_actuelle != [expr $limit($chan,total) + $limit(plus)]} {
pushmode $chan +l [expr $limit($chan,total) + $limit(plus)]
set limit($chan,total,old) $limit($chan,total)
}
}
}
}
}
}
return 0
}
voila se fameux code loll ;p