SA-MP Forums Archive
[HELP] Experience and 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)
+--- Thread: [HELP] Experience and level system (/showthread.php?tid=356103)



[HELP] Experience and level system - anito - 02.07.2012

Hi guys. Is there any way to create /levelup and exp. system.For example, i earn exp. on payday and i need %s exp. points for level %s and etc. I used search and i found one using dini and dudb but i don't like it cuz i got 350 exp. when i kill somebody. I want (like to) :
* 1 exp per payday
* need to have certain numbers of exp. to /levelup
* if i /levelup my score gets +1
Thanks in advance!
Sincerely,
anito


Re: [HELP] Experience and level system - Ricop522 - 02.07.2012

First off create a variable to save the exp and level:

pawn Код:
new exp[MAX_PLAYERS];
new level[MAX_PLAYERS];
After this you can need to create a timer SetTimer to make exp +1 for the player
pawn Код:
exp[playerid]++;
Using the levelup:

pawn Код:
stock nextLevel(playerid){
    return (level[playerid] * 8);
}
if(!strcmp(cmdtext, "/levelup", true)) {
    if(nextLevel(playerid) >= exp[playerid]) {
          // you can have level 2 now!!
          SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
          exp[playerid] = 0; // reset the variable
          level[playerid] ++; // add +1 level          
    }
    return 1;
}
I hope this help.