I tried to test this code, but for some reason (which the network administration is trying to figure out), I'm not getting the snotice when someone does a /whois on me (even though I am an IRCop), so I think this is correct. If I find that it's not correct later, I'll amend or repost as necessary.
Code:
 on *:snotice:*did a /whois on you*:{
  $iif(!$($+(%,whois,.,$1),2),set $+(%,whois,.,$1) 1,.inc $+(%,whois,.,$1))
  if $($+(%,whois,.,$1),2) > 4 {
    kill $1 Don't /whois me that many times
    unset $+(%,whois,.,$1)
  }
}