04.02.2014, 15:53
I believe this happens due to lots of case statements(because it stops to crash for me when u comment some of them). I advise you to use binary search which is a very fast way to set rank especialy when you have a big number of ranks.
pawn Код:
static const Ranks[10] = {0, 400, 2000, 4000, 8000, 10000, 15000, 25000, 30000, 40000};
stock SetPlayerRank(playerid)
{
new score = GetPlayerScore(playerid);
new l, r, m;
l = 0; r = sizeof(Ranks);
while(r > l)
{
m = (r+l) >> 1;
if(Ranks[m] <= score) l = m+1;
else r = m;
}
PlayerRank[playerid] = l;
return l;
}