You could do something like this:
Code:
#whois off
raw 311:*: {
  set %whoisfound 1
  .notice %noticenick $2 has ip $4
}
raw 319:*: {
  set %whoisfound 1
  .notice %noticenick $2 is on chans $3-
}
raw 318:*: {
  .disable #whois
  if (!%whoisfound) {
    .notice %noticenick $2 not found
  }
  unset %whoisfound
}
#whois end


But like argv0 said, you can't always find somebody by his ip.