Thank you for the correction. I will try it as soon as possible.

If i modify the getstat() function like this it returns the rank name instead of the rank number. Is there a way to put the result in an array to use in the hud? Because i tried and it gave me error about not being localized string. Sorry for asking too many questions...

Code:
getstat(stat)
{
    
	switch(stat)
	{
		case "rank":
		return level.ranks[self.stats["rank"]].name;
	}
	
	if(!isdefined(stat))
        return;
    if(!isdefined(self) || !isplayer(self))
        return;
    if(!isdefined(self.stats[stat]))
        return 0;
    else
        return self.stats[stat];
}