Jakwob-WG

[FS] Rank System v1.1

Oct 9th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.57 KB | None | 0 0
  1. //Version 1.1
  2.  
  3.  
  4. #define FILTERSCRIPT
  5.  
  6. #include <a_samp>
  7. #include <zcmd>
  8.  
  9. #define SCM SendClientMessage
  10. #define DIALOG_RANK 3010
  11.  
  12. enum RankInfo
  13. {
  14.     xp,
  15.     level,
  16.     prestige
  17. }
  18. new rInfo[MAX_PLAYERS][RankInfo];
  19.  
  20. public OnPlayerDeath(playerid, killerid, reason)
  21. {
  22.     rInfo[killerid][xp] += 2;
  23.     return 1;
  24. }
  25.  
  26. public OnPlayerUpdate(playerid)
  27. {
  28.     if(rInfo[playerid][xp] == 100)//Levels
  29.     {
  30.         new str[85];
  31.         rInfo[playerid][level] ++;
  32.         rInfo[playerid][xp] = 0;
  33.         GivePlayerMoney(playerid, 50000);
  34.         format(str, sizeof(str), "!CONGRATS! you have leveled up you are now level %d", rInfo[playerid][level]);
  35.         SCM(playerid, -1, str);
  36.     }
  37.     if(rInfo[playerid][level] == 100)//Prestige levels
  38.     {
  39.         new str[85];
  40.         rInfo[playerid][prestige] ++;
  41.         rInfo[playerid][xp] = 0;
  42.         rInfo[playerid][level] = 0;
  43.         format(str, sizeof(str), "!CONGRATS! you have prestiged you are now Prestige Level %d", rInfo[playerid][level]);
  44.         SCM(playerid, -1, str);
  45.     }
  46.     return 1;
  47. }
  48.  
  49. CMD:ranks(playerid, params[])
  50. {
  51.     new str[80], str1[100];
  52.     format(str, sizeof(str), "\tXP: %d\n\tLevel: %d\n\tPrestige: &d\n", rInfo[playerid][xp], rInfo[playerid][level]);
  53.     strcat(str1, str);
  54.     ShowPlayerDialog(playerid, DIALOG_RANK, DIALOG_STYLE_MSGBOX, "Your Rank", str1, "Close", "");
  55.     return 1;
  56. }
  57.  
  58. CMD:givexp(playerid, params[])
  59. {
  60.     if(!IsPlayerAdmin(playerid))return 0;
  61.     {
  62.         rInfo[playerid][xp] += 50;
  63.     }
  64.     return 1;
  65. }
  66.  
  67. CMD:givelvl(playerid, params[])
  68. {
  69.     if(!IsPlayerAdmin(playerid))return 0;
  70.     {
  71.         rInfo[playerid][level] += 50;
  72.     }
  73.     return 1;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment