Percent calculation
#1

Код:
XpToNextLvl[playerid]=20;
Rank[playerid]=1;

if(GetPlayerScore(playerid)>=XpToNextLvl[playerid])
{
 XpToNextLvl[playerid]=XpToNextLvl[playerid]+Rank[playerid]*5; // 20+1*5=25 (if im rank 1)
 Rank[playerid]++;
}

percent=(100*GetPlayerScore(playerid))/XpToNextLvl[playerid];
as you can see i'm creating ranking up system. But there's a problem. I don't know how to count percent for following ranks. Minimum rank XP = 0 %, Maximum rank XP = 100 %. So for example if I'm rank 2, 20 XP should be equal 0% and 25 XP = 100%. My percent formula above calculates percent corretly only for 1st rank, I need fomula for further Ranks
Reply


Messages In This Thread
Percent calculation - by ax1 - 21.08.2016, 20:16
Re: Percent calculation - by Shinja - 21.08.2016, 21:03
Re: Percent calculation - by Gammix - 21.08.2016, 21:44
Re: Percent calculation - by ax1 - 22.08.2016, 11:42

Forum Jump:


Users browsing this thread: 2 Guest(s)