Check that the parameter is a whole number, meaning there is only digit in it, regex can quickly do that, you basically only want to accept digit from 1 to 9, included:
Code:
if (!$regex($2,^[1-9]$)) {
    msg $chan /me $nick to use the !top command you must specify a positive integer.
  }
Without regex, you could check that with $istok:
Code:
if (!$istok(1 2 3 4 5 6 7 8 9,$2,32)) {


#mircscripting @ irc.swiftirc.net == the best mIRC help channel