Code:
; -------------------------------------------------------------------------------------------------
; Protections

#protect.flood off

on @1:TEXT:*:#: {
  ; ----------------------------------- Flood (Repeated Messages)
  ; This is a simple protection that looks for a user repeating the
  ; same message, and if it finds that person, first will warn, then
  ; will set a mute ban, next kick, then ban
  ; ----------------------------------- Flood (Repeated Messages)
  if (%text. [ $+ [ $nick ] ] != $1-) /set -u300 %text. [ $+ [ $nick ] ] $1-
  else {
    ; Increase number of duplicate messages
    /inc -u5 %flood. [ $+ [ $nick ] ]
    ;check how many times we've had to see that message
    if (%flood. [ %+ [ %nick ] ] == 3) {
      /unset %flood. [ $+ [ $nick ] ]
      ; increase number of times we've had to deal with this person
      /inc -u1800 %warn. [ $+ [ $nick ] ]
      ; take action
      /takeaction $chan $nick Flood Flooding (5 lines, 3 seconds)
    }
  }
}

#protect.flood end

#protect.spam off

on @1:TEXT:*:#: {
  ; ----------------------------------- Spam (Repeated Gibberish)
  ; This is also a simple protection, as it will find a person typing
  ; several lines, but with any line of text.  This has the same actions
  ; as the flood protection, but is 7 lines in 5 seconds.
  ; ----------------------------------- Spam (Repeated Gibberish)
  /inc -u5 %spam. [ $+ [ $nick ] ]
  ; they passed limit
  if (%spam. [ $+ [ $nick ] ] == 7) {
    /unset %spam. [ $+ [ $nick ] ]
    ; increase times dealt with
    /inc -u1800 %warn. [ $+ [ $nick ] ]
    ; take action
    /takeaction $chan $nick Spam Spamming (7 lines, 5 seconds)
  }
}

#protect.spam end

; -------------------------------------------------------------------------------------------------
; Aliases

; take action - use when %warn.(name) has been declaired
; syntax: /takeaction <channel> <nickname> <action> <reason(if kicked)>
; Example: /takeaction #king-tomato ChanSys Flood Flooding (7 lines, 5 seconds)
alias -l takeaction {
  ; set some easy-to-use variables
  /set -u0 %chan $1
  /set -u0 %nick $2
  /set -u0 %word $3
  /set -u0 %reason $4-

  ; Now, to take action
  if (%warn. [ $+ [ %nick ] ] == 1) {
    ; warning
    /msg %chan Please do not %word the channel $nick $+ . Further to do so will result in kicks and/or bans.
  }
  else if (%warn. [ $+ [ %nick ] ] <= 3) {
    ; mute ban
    /mode %chan -ov+b %nick %nick $address(%nick, 1)
  }
  else if (%warn. [ $+ [ %nick ] ] <= 6) {
    ; kick
    /mode $chan -ov $nick $nick
    /kick $chan %nick %reason
  }
  else if (%warn. [ $+ [ %nick ] ] != $null) {
    /mode %chan -ov+b %nick %nick $address(%nick, 11)
    /kick %chan %nick Banned! %reason
  }
}