SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=153301)



Help - _TeraN_ - 08.06.2010

Help please.
I have a problem. I installed textdraw (found somewhere on the forum) which shows your Level and Respect. It shows level and respects properly, but number of Respects needed for new level is always shown as 4. The problem in levelexp, am I right? It's set to 'new levelexp = 4' by default
This Code:
Код:
if(gPlayerLogged[i] == 1)
{
TextDrawHideForPlayer(i, InfoTextDraw);
format(string,sizeof(string),"LVL: %d~n~Respect: %d/%d",PlayerInfo[i][pLevel],PlayerInfo[i][pExp],levelexp);
InfoTextDraw = TextDrawCreate(547.000000,40.000000,string);
TextDrawAlignment(InfoTextDraw,0);
TextDrawBackgroundColor(InfoTextDraw,0x000000ff);
TextDrawFont(InfoTextDraw,1);
TextDrawLetterSize(InfoTextDraw,0.299999,1.100000);
TextDrawColor(InfoTextDraw,0xffffffff);
TextDrawSetOutline(InfoTextDraw,1);
TextDrawSetProportional(InfoTextDraw,1);
TextDrawSetShadow(InfoTextDraw,1);
TextDrawShowForPlayer(i, InfoTextDraw);
}



Re: Help - Hiddos - 08.06.2010

Well, if you've set 'levelexp' to 4, it'll output 4. If it's like: Level 1: 4 xp - Level 2: 8xp - Level 3: 12xp

Then try this:

pawn Код:
format(string,sizeof(string),"LVL: %d~n~Respect: %d/%d",PlayerInfo[i][pLevel],PlayerInfo[i][pExp],levelexp*(PlayerInfo[i][pLevel]+1)); // Gets the player's level, counts +1 (Next level) and multiplies it by 4 (XP required for one next level)



Re: Help - Naxix - 08.06.2010

Quote:
Originally Posted by Hiddos
Well, if you've set 'levelexp' to 4, it'll output 4. If it's like: Level 1: 4 xp - Level 2: 8xp - Level 3: 12xp

Then try this:

pawn Код:
format(string,sizeof(string),"LVL: %d~n~Respect: %d/%d",PlayerInfo[i][pLevel],PlayerInfo[i][pExp],levelexp*(PlayerInfo[i][pLevel]+1)); // Gets the player's level, counts +1 (Next level) and multiplies it by 4 (XP required for one next level)
Wouldn't that output level 1: 5xp 2: 10 xp and so on, as if levelexp is 4 and you times it with the level +1 you wont get 4,8,12 and so on.


Re: Help - Hiddos - 08.06.2010

Quote:
Originally Posted by Naxix
Quote:
Originally Posted by Hiddos
Well, if you've set 'levelexp' to 4, it'll output 4. If it's like: Level 1: 4 xp - Level 2: 8xp - Level 3: 12xp

Then try this:

pawn Код:
format(string,sizeof(string),"LVL: %d~n~Respect: %d/%d",PlayerInfo[i][pLevel],PlayerInfo[i][pExp],levelexp*(PlayerInfo[i][pLevel]+1)); // Gets the player's level, counts +1 (Next level) and multiplies it by 4 (XP required for one next level)
Wouldn't that output level 1: 5xp 2: 10 xp and so on, as if levelexp is 4 and you times it with the level +1 you wont get 4,8,12 and so on.
levelexp*(PlayerInfo[i][pLevel]+1)

Code between () will be calculated before it calculates with something else.
Wrong would be:

levelexp*(PlayerInfo[i][pLevel])+1


Re: Help - Naxix - 08.06.2010

Oh, sorry didn't see the "+1" was inside the ( ). My mistake.


Re: Help - _TeraN_ - 08.06.2010

Thx to all, it's working