Code:
 on *:nick:{
  inc $+(%,nick.,$address)
  if $calc($ctime - $($+(%,ctime.,$address),2)) < 1 && $($+(%,nick.,$address),2) > 1 {
    var %chan = $comchan($newnick,0)
    while %chan {
      if ($me isop $comchan($newnick,%chan)) {
        .ban -k $comchan($newnick,%chan) $newnick Nick Flood Protection
      }
      dec %chan
    }
  }
  else set %ctime $+(%,ctime.,$address)
}


That code will work as is. I realize that you didn't ask for the specific code, but it was easier to give you the code rather than try to explain what needed to be done without actually giving the code.