Code:
sub EVENT_DEATH {
# leave early if hard mode not set
return unless (defined $qglobals{'hardmode'});
if ($qglobals{'hardmode'} == 1) {
# $my CorpseCount = 0 does nothing
# $charid isn't being used at all
$client->Message(15, "LoL!");
# one set level statement for both conditions
quest::setlevel($ulevel < 70 ? 51 : 70);
} elsif ($qglobals{'hardmode'} == 2) {
# ...
}
}
Cutting down on repetition and using things like strict mode will help you troubleshoot your scripts.