The code that I had originally supplied has been tested and it does work for me. I will add comments in the code to help explain it.

Code:
on *:text:!timeout*:#: {
  if ($nick isop $chan) {
    if ($2 == line) {
      if ($3 isnum) {
        %spamline = $abs($int($3))
        msg # Spamline is now $abs($int($3)) $+ . Messaging $abs($int($3)) times in a row will timeout you!
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == time) {
      if ($3 isnum) {
        %spamtime = $abs($int($3))
        msg # Timeout time is now $abs($int($3)) $+ !
      }
      else { msg # $3 is not a number! | return }
    }
    elseif ($2 == message) {
      %spammessage = $3-
      msg # Timeout message is now : $3-
    }
    else { msg # insufficient parameters. !timeout <line,time,message> <parameter> }
  }
  else {
    msg # You dont have permission to do that!
  }
}

on *:text:*:#: {
; 1) The first IF statement checks to see if the user is the last user to type anything in chat.
; If they are the last user to type anything, then the code will increase their amount of
; spamlines by 1. If this number reaches 3 (%spamlines), then this will time the user out.
  if ($nick == %spamnick) {
    inc %spamlines
    if (%spamlines == %spamline) {
      msg # .timeout $nick %spamtime %spammessage
      msg # $nick you're spamming too fast. slow down!
      %spamlines = 1
    }
  }
; 2) If the last user to type anything in chat is a MOD, this will UNSET (delete) the name of the
; last user to type anything in chat (%spamnick) as well as the number of %spamlines.
; Also, because this code happens BEFORE the next 'else' statement, a MOD can NEVER be the user
; that sets the %spamnick and %spamlines. Therefor, a MOD typing anything in chat will ALWAYS
; reset the %spamnick and %spamlines variables back to 0 by UNSETing them.
  elseif ($nick isop $chan) {
    unset %spamnick
    unset %spamlines
  }
; 3) If a user is NOT a mod (because of above 'elseif' statement) and is NOT the last person to
; trigger the spam protection (because of first 'if' statement), then this statement will set
; that user as the current %spamnick variable and set the %spamlines to 1.
  else {
    %spamnick = $nick
    %spamlines = 1
  }
}