An example that used to be on the #Helpdesk website:

Code:
[color:green]on @*:text:*:#: {
  if ($nick isop #) { return }
  set -u3 %fld. [ $+ [ $chan ] $+ . $+ [ $nick ] ] $calc( %fld. [ $+ [ $chan ] $+ . $+ [ $nick ] ] + 1)
  if (%fld. [ $+ [ $chan ] $+ . $+ [ $nick ] ] >= 5) {
    ban -ku60 # $nick 11 Please don't flood
  }
}
[/color]

This will unban the user after 60 seconds, if you don't want that to happen, just remove the 'u60' from the ban command.

You can also find a number of addons or protection scripts/snippets, from some scripting websites:

www.mirc.net
www.mircscripts.org
www.mircscripts.com
www.hawkee.com
www.scriptheaven.net
www.google.com (Search)

Hope this helps!

Regards,