try this, but i'm not sure because i haven't tested it:

Code:
-
Warning
  .Spam:{
    var %num = % $+ $1 $+ -war-spam
    inc %num
    if (%num < 3) { .msg $chan 4 $1 this is warning nr. %num  cause SPAM }
    else {
    unset % $+ $1 $+ -war-spam
    .msg $chan 4 $+ $1 $+  this was the third warning cause SPAM ---- have fun been banned
    ban -k $chan $1 3
  }
}