SA-MP Forums Archive
Exp and 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)
+--- Thread: Exp and Level (/showthread.php?tid=403885)



Exp and Level - Zex Tan - 01.01.2013

Hello, let's just straight forward to the topic,

Well, what I want to know is that, if every time if a player level -up and their EXP will get higher and higher.

Example: Currently I'm level 2 and I've 12/12 experience , after I /levelup and it will go like this

Level 3 0/16 Experience, so every time a player level-up, their Experience target will +4.

So my question is, is there any example of how to make the player's experience target to +4 after level-up ?

BTW, sorry for bad english


Re: Exp and Level - Ryuuji Takasu - 01.01.2013

There is an example but I can't remember it but you need to search on the forums thought.


Re: Exp and Level - Lordzy - 01.01.2013

Kinda:
pawn Код:
new Exp[MAX_PLAYERS];
new Levelup[MAX_PLAYERS];
new Exptarg[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
 Exp[killerid]++; //Ups the exp of killer.
 return 1;
}

public OnPlayerUpdate(playerid)
{
 if(Exp[playerid] == Exptarg)
 {
   Levelup[playerid]++; //If the player's experience is equal or more that the needed experience to Level up, then  a level up.
   Exptarg[playerid] = Levelup[playerid]+2; //Next experience target will be +2 from the current level.
   Exp[playerid] = 0; //Resets the experience.
 }
 return 1;
}



Re: Exp and Level - Zex Tan - 01.01.2013

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
Kinda:
pawn Код:
new Exp[MAX_PLAYERS];
new Levelup[MAX_PLAYERS];
new Exptarg[MAX_PLAYERS];

public OnPlayerDeath(playerid, killerid, reason)
{
 Exp[killerid]++; //Ups the exp of killer.
 return 1;
}

public OnPlayerUpdate(playerid)
{
 if(Exp[playerid] == Exptarg)
 {
   Levelup[playerid]++; //If the player's experience is equal or more that the needed experience to Level up, then  a level up.
   Exptarg[playerid] = Levelup[playerid]+2; //Next experience target will be +2 from the current level.
   Exp[playerid] = 0; //Resets the experience.
 }
 return 1;
}
Thank you for giving an example of it Lordz. This is what I want