Score left for next rank?
#1

Hello, im wondering if there is any stock to calculate the score left.

I mean: I have a rank system in my server and i wanna show the score left for the next rank: (Ex: Player is rank 1 with 10 score, for be rank 2 you need 15 score, so the score left for rank 2 is 5).

Is possible?
Reply
#2

You need more variable to store

like

PlayerCurrenRank
PlayerCurrentScore
PlayerScoreToReach

you can subtract to get the score left
Reply
#3

yes you need more variable
or
pawn Код:
stock GetScore(playerid)
{
  if(GetPlayerScore(playerid) <=0)
  {
     SendClientMessage(playerid,-1,"0/10");
   }
}
Reply
#4

Ok, i have currently the rank and the score saved, so i just need to do something like:

pawn Код:
new Float:scoreleft= (float(GetPlayerScore(playerid))/float(pInfo[playerid][Rank]));
...?

Or i have to define what score you need for every rank?
Reply
#5

If every rank need a multiplied score to rank up like

rank 1-2 15
rank 2-3 30


you can do
pawn Код:
scoreneeded = pInfo[playerid][Rank] * 2;
scoreleft = GetPlayerScore(playerid) - scoreneeded;
Only if the multiply case
Reply
#6

Every rank has a different score needed, like rank 1: 100, rank 2: 200, rank 3: 350 and so on.
Reply
#7

And where you store the score needed for rank?
Reply
#8

Generally you would want an increase in rank to be exponentially bigger than the previous rank. So in the beginning you level up faster, but as you get higher in rank it becomes increasingly tougher to achieve the next rank. This keeps the game challenging. You can write an algorithm to calculate that, if you wish.

http://en.wikipedia.org/wiki/Exponential_growth
Reply
#9

Quote:
Originally Posted by Vince
Посмотреть сообщение
Generally you would want an increase in rank to be exponentially bigger than the previous rank. So in the beginning you level up faster, but as you get higher in rank it becomes increasingly tougher to achieve the next rank. This keeps the game challenging. You can write an algorithm to calculate that, if you wish.

http://en.wikipedia.org/wiki/Exponential_growth
Yeah i know how the exponential growth works..i'll look on it further.

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
And where you store the score needed for rank?
I don't store it, maybe i have? I store just the current player score and rank.

EDIT: Sei italiano?
Reply
#10

Quote:

Hello, im wondering if there is any stock to calculate the score left

They're called functions - "stock" is just the name of an attribute.

Quote:

I have a rank system in my server and i wanna show the score left for the next rank: (Ex: Player is rank 1 with 10 score, for be rank 2 you need 15 score, so the score left for rank 2 is 5).

This is entirely possible by subtracting the player's score from the score needed to achieve next rank. To do this just store all the needed scores in a variable.

When showing the score - simply subtract the score (GetPlayerScore) from the variable.

Example:

pawn Код:
// Globally you've defined the scores needed in an array, e.g.:
new
    g_RankScores[] =
    {
        0,        // Rank 1 should be the starting rank, so no score needed for that one
        15,      // Rank 2 should be at 15 score
        // etc.
    }
;

// Wherever you're showing the player's needed score to achieve next rank:
new
    iNeededScore = ( g_RankScores[ VARIABLE_HOLDING_PLAYER_RANK ] - GetPlayerScore( playerid ))
;
Something like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)