You could shorten the code to this:
on *:TEXT:!emmm*:#:{
var %emmm = $rand(1,$2)
if (%emmm != $null) && (%emmm <= 10) msg $chan emmm answer: $calc(%emmm + 2)
}
As I saw in your script, the answer is always "two plus %emmm". This is basically what my revision does. I also saw that %emmm only went up to ten. This revision also makes sure that %emmm only goes up to ten.