on *:TEXT:*:#*:{ $flood_counter }
on *:ACTION:*:#*:{ $flood_counter }
on *:NICK:{
var %table flood , %timeframe 300 , %wilditem $+(*!,$fulladdress)
while ($hfind(%table,%wilditem,1,w)) {
hdel %table $v1
hadd -u $+ %timeframe %table $puttok($v1,$newnick,3,33)
}
}
alias flood_counter {
var %timeframe 300 , %max.messages 5 , %table flood
if (!$hget(%table)) { hmake %table 101 | hadd %table counter 1 }
var %counter $hget(%table,counter) | hinc %table counter 1
var %item $+(%counter,!,$chan,!,$fulladdress) , %wilditem $+(*!,$chan,!,$fulladdress)
hadd -u $+ %timeframe %table %item | var %msg_count $hfind(%table,%wilditem,0,w)
echo -s debug message: $nick has %msg_count messages in the last %timeframe seconds. You can delete this line
if (%msg_count >= %max.messages) {
echo -s action to take against $nick in $chan goes inside these brackets. This is where the time-out command goes
}
}