Rather than a script, check with the IRCops and see if the IRCd supports flood protection.

I know Unreal has several options that can be set for controlling this on a channel by channel basis.