Problem with < and >, and mutliplying [level system] - 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: Problem with < and >, and mutliplying [level system] (
/showthread.php?tid=275407)
Problem with < and >, and mutliplying [level system] [FIXED!] -
Sledge - 09.08.2011
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.
Re: Problem with < and >, and mutliplying [level system] -
MadeMan - 09.08.2011
pawn Код:
if(playerVariables[playerid][pEXP] >= neededEXP[playerid])
Re: Problem with < and >, and mutliplying [level system] -
Cameltoe - 09.08.2011
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]);
}