There's one section of your code that you can shorten a lot more using:
tokenize 32 %people if ($1-5 != $null) { var %x = 1 while (%x <= 5) { inc %points [ $+ [ $+($,%x) ] ] inc %x } unset %amount %people %lottery msg # the lottery was ended by $nick $+ ! }