Rank system won't work.
#1

So, I'm currently working on a rank/xp system but can't get it working.
Basically when someone has enough XP, he keeps getting a higher level.

Code: http://pastebin.com/X68SYeCD
If there is anything else you need, then I'll add it.
Reply
#2

try these
pawn Код:
public UpdatePlayerLevel(playerid)
{
        new newlevelxp;
        newlevelxp = GetXPAmount(pInfo[playerid][pLevel]);
        if(pInfo[playerid][pExp] > newlevelxp[playerid])
        {
            SendClientMessage(playerid, -1, "this means you have leveled up");
            pInfo[playerid][pLevel]++;
            return 0;
        }
        return 1;
}

stock GetXPAmount(rankid)
{
        new xpamount;
        switch(rankid)
        {
            case 0: xpamount = 100;
                case 1: xpamount = 200;
                case 2: xpamount = 400;
                case 3: xpamount = 800;
                case 4: xpamount = 1600;
                case 5: xpamount = 3200;
                case 6: xpamount = 6400;
                case 7: xpamount = 12800;
                case 8: xpamount = 25600;
                case 9: xpamount = 51200;
                case 10: xpamount = 10240;
        }
        return xpamount;
}
Reply
#3

Код:
.pwn(352) : error 028: invalid subscript (not an array or too many subscripts): "newlevelxp"
.pwn(352) : warning 215: expression has no effect
.pwn(352) : error 001: expected token: ";", but found "]"
.pwn(352) : error 029: invalid expression, assumed zero
.pwn(352) : fatal error 107: too many error messages on one line
Reply
#4

which is line 352
Reply
#5

I fixed that one already, but it still won't work after that.
Reply
#6

is his level keeps on increasing in textdraw
or
"this means you have leveled up" this mesage keeps popping up>?
Reply
#7

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
is his level keeps on increasing in textdraw
or
"this means you have leveled up" this mesage keeps popping up>?
Level keeps increasing on the textdraw and the message keeps popping up.
Reply
#8

pawn Код:
public UpdatePlayerLevel(playerid)
{
        new newlevelxp;
        newlevelxp = GetXPAmount(pInfo[playerid][pLevel]);
printf("current exp = %i || Next level exp = %i",pInfo[playerid][pExp], newlevelxp);
        if(pInfo[playerid][pExp] > newlevelxp[playerid])
        {
            SendClientMessage(playerid, -1, "this means you have leveled up");
            pInfo[playerid][pLevel]++;
            return 0;
        }
        return 1;
}
use this and show server log
Reply
#9

This is happening because you don't reset current player exp while leveling up.
pawn Код:
if(pInfo[playerid][pExp] > newlevelxp[playerid])
        {
            SendClientMessage(playerid, -1, "this means you have leveled up");
            pInfo[playerid][pLevel]++;
            pInfo[playerid][pExp] = 0;
            newlevelxp[playerid] = newlevelxp[playerid] * pInfo[playerid][pLevel];
            return 0;
        }
Reply
#10

Quote:
Originally Posted by icra
Посмотреть сообщение
This is happening because you don't reset current player exp while leveling up.
pawn Код:
if(pInfo[playerid][pExp] > newlevelxp[playerid])
        {
            SendClientMessage(playerid, -1, "this means you have leveled up");
            pInfo[playerid][pLevel]++;
            pInfo[playerid][pExp]
            newlevelxp[playerid] = newlevelxp[playerid] * pInfo[playerid][pLevel];
            return 0;
        }
thats just wrong because he is using GetXpAmount stock so he wouldnt need to do that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)