SHARE
TWEET

Jakwobs Xp/Lvl/Prestige system

a guest Sep 5th, 2014 524 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3.        $$$$$\           $$\                               $$\      ™
  4.        \__$$ |          $$ |                              $$ |
  5.           $$ | $$$$$$\  $$ |  $$\ $$\  $$\  $$\  $$$$$$\  $$$$$$$\
  6.           $$ | \____$$\ $$ | $$  |$$ | $$ | $$ |$$  __$$\ $$  __$$\
  7.     $$\   $$ | $$$$$$$ |$$$$$$  / $$ | $$ | $$ |$$ /  $$ |$$ |  $$ |
  8.     $$ |  $$ |$$  __$$ |$$  _$$<  $$ | $$ | $$ |$$ |  $$ |$$ |  $$ |
  9.     \$$$$$$  |\$$$$$$$ |$$ | \$$\ \$$$$$\$$$$  |\$$$$$$  |$$$$$$$  |
  10.      \______/  \_______|\__|  \__| \_____\____/  \______/ \_______/
  11.                                    _____________________________
  12.                                   |      Created By Jakwob™     |
  13.                   |  Do not claim its your own  |
  14.                   |________©2014 Jakwob™________|                             */
  15.  
  16. #define FILTERSCRIPT
  17.  
  18. #include <a_samp>
  19. #include <zcmd>
  20. #include <YSI\y_ini>
  21.  
  22. #define UserPath "Levels/%s.ini"
  23. #define SCM SendClientMessage
  24. #define DIALOG_RANK 3010
  25.  
  26. enum RankInfo
  27. {
  28.         xp,
  29.         level,
  30.     prestige
  31. }
  32. new rInfo[MAX_PLAYERS][RankInfo];
  33.  
  34. public OnFilterScriptInit()
  35. {
  36.         return 1;
  37. }
  38.  
  39. stock Path(playerid)
  40. {
  41.     new str[128],name[MAX_PLAYER_NAME];
  42.     GetPlayerName(playerid,name,sizeof(name));
  43.     format(str,sizeof(str),UserPath,name);
  44.     return str;
  45. }
  46. forward loadaccount_user(playerid, name[], value[]);
  47. public loadaccount_user(playerid, name[], value[])
  48. {
  49.     INI_Int("XP",rInfo[playerid][xp]);
  50.     INI_Int("Level",rInfo[playerid][level]);
  51.     INI_Int("Prestige",rInfo[playerid][prestige]);
  52.     return 1;
  53. }
  54.  
  55. public OnPlayerConnect(playerid)
  56. {
  57.         INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
  58.         return 1;
  59. }
  60.  
  61. public OnPlayerDisconnect(playerid, reason)
  62. {
  63.  
  64.         new INI:file = INI_Open(Path(playerid));
  65.         INI_SetTag(file,"Player Levels");
  66.     INI_WriteInt(file,"XP",rInfo[playerid][xp]);
  67.     INI_WriteInt(file,"Level",rInfo[playerid][level]);
  68.     INI_WriteInt(file,"Prestige",rInfo[playerid][prestige]);
  69.     INI_Close(file);
  70.     return 1;
  71. }
  72.  
  73. public OnPlayerDeath(playerid, killerid, reason)
  74. {
  75.         rInfo[killerid][xp] += 1;
  76.         return 1;
  77. }
  78.  
  79. public OnPlayerUpdate(playerid)
  80. {
  81.         if(rInfo[playerid][xp] > 100)//Levels
  82.         {
  83.             new str[85];
  84.             rInfo[playerid][level] ++;
  85.             rInfo[playerid][xp] = 0;
  86.             GivePlayerMoney(playerid, 50000);
  87.             format(str, sizeof(str), "{FF9900}!CONGRATS! {FFFFFF}you have leveled up you are now level %d", rInfo[playerid][level]);
  88.             SCM(playerid, -1, str);
  89.         }
  90.         if(rInfo[playerid][level] > 100)//Prestige levels
  91.         {
  92.             new str[85];
  93.             rInfo[playerid][prestige] ++;
  94.             rInfo[playerid][xp] = 0;
  95.             rInfo[playerid][level] = 0;
  96.             GivePlayerMoney(playerid, 1000000);
  97.             format(str, sizeof(str), "{FF9900}!CONGRATS! {FFFFFF}you have prestiged you are now Prestige Level %d", rInfo[playerid][prestige]);
  98.             SCM(playerid, -1, str);
  99.         }
  100.         return 1;
  101. }
  102.  
  103. CMD:ranks(playerid, params[])
  104. {
  105.         new str[300], str1[1000];
  106.         format(str, sizeof(str), "XP: %d\nLevel: %d\nPrestige: %d\n", rInfo[playerid][xp], rInfo[playerid][level]);
  107.         strcat(str1, str);
  108.         format(str, sizeof(str), "\n/t{FFFFFF}** {FF9900}XP {FFFFFF}**\n");
  109.         strcat(str1, str);
  110.         format(str, sizeof(str), "\nXP can be gained by many methods.\nKilling Players - 1 XP\nJobs - 4 XP\nEvents - 2 XP\n");
  111.         strcat(str1, str);
  112.         format(str, sizeof(str), "\n/t{FFFFFF}** {FF9900}Leveling up {FFFFFF}**\n");
  113.         strcat(str1, str);
  114.         format(str, sizeof(str), "\nUpon leveling up you will recieve a cash bonus each time you level up.\n");
  115.         strcat(str1, str);
  116.         format(str, sizeof(str), "\n/t{FFFFFF}** {FF9900}Prestige {FFFFFF}**\n");
  117.         strcat(str1, str);
  118.         format(str, sizeof(str), "\nWhen you reach the maximum level you will beable to access the Prestige\n You will recieve a huge cash bonus of $1 million each time you prestige.\n");
  119.         strcat(str1, str);
  120.         ShowPlayerDialog(playerid, DIALOG_RANK, DIALOG_STYLE_MSGBOX, "Your Rank", str1, "Close", "");
  121.         return 1;
  122. }
  123.  
  124. CMD:givexp(playerid, params[])
  125. {
  126.     if(!IsPlayerAdmin(playerid))return 0;
  127.     {
  128.                 rInfo[playerid][xp] += 50;
  129.         }
  130.         return 1;
  131. }
  132.  
  133. CMD:givelvl(playerid, params[])
  134. {
  135.     if(!IsPlayerAdmin(playerid))return 0;
  136.     {
  137.                 rInfo[playerid][level] += 50;
  138.         }
  139.         return 1;
  140. }
RAW Paste Data
Top