08.12.2013, 14:31
pawn Код:
stock GetPlayerRankNumber(playerid, exp)
{
new
i = -1,
exp = GetPlayerScore(playerid);
;
while((++i < sizeof Ranks) && (exp < Ranks[i][RankXP]))
{
if( exp > Ranks[i][RankXP])
{
i++;
if(exp < Ranks[i][RankXP])
{
Ranks[playerid][RankNumber] = Ranks[i-1][RankXP];
}
}
return Ranks[playerid][RankNumber];
}
if(i == sizeof Ranks)
{
return printf("Warning: Experience must match at least the lowest rank (%d / %d)", exp, Rank[0][RankXp]);
}
}