That should work fine, but else { halt } is pointless seeing as mIRC does that anyway.

You could use an else { } statement instead of that second elseif too:

on *:TEXT:!guessnumber*:#:{
  var %guessnumbernum = $rand(0,100) 
  echo -a The number is %guessnumbernum
  if ($2 == $null) { msg $chan Pick a number. Syntax is !guessnumber number }
  elseif ($2 != %guessnumber) { msg $chan Sorry, that's not the number. Try again? }
  else { msg $chan YOU WIN! }

Also, rather than using /set and then /unset, if you declare a variable with /var it will be unset automatically when the current script ends.