while(src.XP >= src.MXP)
var/remainder = src.XP - src.MXP
src << "<center><b> You have leveled up to level [lvl]</center>\n\n\n\n"
src.lvl += 1
src.XP += remainder
I noticed that too many games / resources use the if() proc for levelchecking. This can work, but you have to do so many work-arounds to level more than once. If you use the while() proc, there's no need to loop your Level() proc just because you gained 1000 XP when your maximum is 10.