EXP to Next level?
#1

How would i go about detecting the amount of XP the player has till there next level?

Example of XP..

Level 1: 0-10 XP
Level 2: 11-20 XP
Level 3: 21-30 XP.

How would i detect how much XP they need untill the next level? Its going into a TD.
Reply
#2

A simple IF statement will help you.

Код:
if (pXP[playerid] >= 11) {
//Upgrade the player here
pLevel[playerid]++;
}
Basically says:

If the player has more then or equal to 11 XP, do Set his level + 1.

Hope this helps
Reply
#3

i know how to do that, I mean..

Detecting the space in between..
like..

You have 6 XP, You need 4 more XP to reach level 1.
Reply
#4

if (pXP[playerid] <= 11) {
pXP[playerid] = 11 - pXP[playerid];
new string[256];
format(string, sizeof(string), "You need %d more points till level 2!",pXP[playerid]);
SendClientMessage(playerid, COLOR, string);
}

Not tested however showed work.

If the player is below the amount needed to upgrade, - that value to get the value they still need and tell it to them.

ex. mine is 6. I still need 5 more points
Reply
#5

pawn Код:
format(stirng, sizeof(string), "You need %d more points till level 2!");
Wont work for obvious reasons, but i get the idea, Thanks!
Reply
#6

Quote:
Originally Posted by LilGunna
Посмотреть сообщение
pawn Код:
format(stirng, sizeof(string), "You need %d more points till level 2!");
Wont work for obvious reasons, but i get the idea, Thanks!
Ah, typo. Mind me I was trying to type fast.

Anyways glad I can help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)