Problem with < and >, and mutliplying [level system]
#1

pawn Код:
neededEXP[playerid] = playerVariables[playerid][pLevel] * 8;

if(playerVariables[playerid][pLevel] * 8 >= neededEXP[playerid]) //If I set as > the player keeps leveling up regardless of his EXP amount. If I set it to < the player can't level up no matter what his EXP is.
        {
            //level 1 player has less than 8
            playerVariables[playerid][pLevel] += 1;
            playerVariables[playerid][pEXP] = 0;
            format(string, sizeof(string), "Congratulations! You have gained a level! You have unlocked new features.");
            SendClientMessage(playerid, COLOR_YELLOW, string);
            format(string, sizeof(string), "You are now level %d. Your EXP has been resetted to 0.", playerVariables[playerid][pLevel]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            SetPlayerScore(playerid, playerVariables[playerid][pLevel]);
        }
Can someone please help me fix this code? I want it so their current player level times (mutlied by) 8 is greater than their neededEXP. If it is greater than their neededEXP then they may level up, else they the script will just tell them how much EXP they need.
Reply
#2

pawn Код:
if(playerVariables[playerid][pEXP] >= neededEXP[playerid])
Reply
#3

pawn Код:
if(playerVariables[playerid][pEXP] >=  (playerVariables[playerid][pLevel] * 8 ))
{
        playerVariables[playerid][pLevel] += 1;
        playerVariables[playerid][pEXP] = 0;
        format(string, sizeof(string), "Congratulations! You have gained a level! You have unlocked new features.");
        SendClientMessage(playerid, COLOR_YELLOW, string);
        format(string, sizeof(string), "You are now level %d. Your EXP has been resetted to 0.",                            playerVariables[playerid][pLevel]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        SetPlayerScore(playerid, playerVariables[playerid][pLevel]);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)