EXP to Next level? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: EXP to Next level? (
/showthread.php?tid=167324)
EXP to Next level? -
DiddyBop - 11.08.2010
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.
Re: EXP to Next level? -
mrmuffins - 11.08.2010
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
Re: EXP to Next level? -
DiddyBop - 11.08.2010
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.
Re: EXP to Next level? -
mrmuffins - 11.08.2010
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
Re: EXP to Next level? -
DiddyBop - 11.08.2010
pawn Код:
format(stirng, sizeof(string), "You need %d more points till level 2!");
Wont work for obvious reasons, but i get the idea, Thanks!
Re: EXP to Next level? -
mrmuffins - 11.08.2010
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