Guest User

Perk System

a guest
May 25th, 2018
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 19.57 KB | None | 0 0
  1. /*******************************************************************
  2.  *                                   Credits......                 *
  3.  *                                                                 *
  4.  *                                                                 *
  5.  * >>>>>>>>>>> Don't remove credits..............<<<<<<<<<<<       *
  6.  *                                                                 *
  7.  * >>>>>>>>>>>>Don't release it without my permission...<<<<<<<    *
  8.  *                                                                 *
  9.  * >>>>CaptainBoi: Working on it all the time.. <<<                *
  10.  *                                                                 *
  11.  * >>>>Morken: Helping me... <<<<                                  *
  12.  *                                                                 *
  13.  * Includes : <a_samp> | SA:MP  || <sscanf2> |  [well]idk ||<dini> | Dracoblue || <zcmd> | Zeex
  14.  *                                                                 *
  15.  *>>>>>>>>>>>>> Comment Below How Is It.... <<<<<<<<<<<<           *
  16.  *                                                                 *
  17.  ******************************************************************/
  18. #define FILTERSCRIPT
  19.  
  20. /* Includes */
  21. #include <a_samp>
  22. #include <sscanf2>
  23. #include <dini>
  24. #include <zcmd>
  25.  
  26. /* Colors */
  27. #define COLOR_RED 0xFF0000FF
  28. #define COLOR_WHITE 0xFFFFFFFF
  29. #define COLOR_YELLOW 0xFFFF00FF
  30. #define COLOR_GREEN 0x00FF00FF
  31. #define COLOR_ORANGE 0xFF9900FF
  32.  
  33. /* Dialogs */
  34. #define DIALOG_PERKS 1
  35.  
  36. /* Variables */
  37. new perkpoints[MAX_PLAYERS];
  38. new perks[MAX_PLAYERS][10][5];
  39. new perkcd[MAX_PLAYERS][10];
  40. new perkregentimer[MAX_PLAYERS];
  41. new Float:pmaxhealth[MAX_PLAYERS];
  42. new Float:pmaxarmour[MAX_PLAYERS];
  43. new Float:phealth[MAX_PLAYERS];
  44.  
  45. /* Account Location */
  46. #define accounts "accounts"
  47.  
  48. /* File Location */
  49. FileDirectory(location[], file[])
  50. {
  51.     new dname[128];
  52.     format(dname, sizeof(dname), "%s/%c/%s.ini", location, file[0] != '.' ? file[0] : '#', file);
  53.     return dname;
  54. }
  55.  
  56. /* Player Name */
  57. playername(playerid)
  58. {
  59.  new pname[MAX_PLAYER_NAME];
  60.  GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
  61.  return pname;
  62. }
  63. public OnFilterScriptInit()
  64. {
  65.     print("\n--------------------------------------");
  66.     print(" Perk System By CaptainBoi");
  67.     print("--------------------------------------\n");
  68.     return 1;
  69. }
  70.  
  71. public OnFilterScriptExit()
  72. {
  73.     return 1;
  74. }
  75.  
  76. public OnPlayerConnect(playerid)
  77. {
  78.     phealth[playerid] = 0.0;
  79.     pmaxhealth[playerid] = 0.0;
  80.     pmaxarmour[playerid] = 0.0;
  81.     return 1;
  82. }
  83.  
  84. public OnPlayerDisconnect(playerid, reason)
  85. {
  86.     return 1;
  87. }
  88.  
  89. public OnPlayerSpawn(playerid)
  90. {
  91.     pmaxhealth[playerid] = dini_Int(FileDirectory(accounts, playername(playerid)), "maxhealth");
  92.     perkpoints[playerid] = dini_Int(FileDirectory(accounts, playername(playerid)), "perkpoints");
  93.     perks[playerid][0][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "invur");
  94.     perks[playerid][1][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "jugg");
  95.     perks[playerid][2][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "regenlevel");
  96.     perks[playerid][3][0] = dini_Int(FileDirectory(accounts, playername(playerid)), "stunlevel");
  97.     return 1;
  98. }
  99.  
  100. public OnPlayerDeath(playerid, killerid, reason)
  101. {
  102.     phealth[playerid] = pmaxhealth[playerid];
  103.     return 1;
  104. }
  105.  
  106. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  107. {
  108.     if(dialogid == DIALOG_PERKS)
  109.     {
  110.        if(response)
  111.        {
  112.             switch(listitem)
  113.             {
  114.                 case 0:
  115.                 {
  116.                  new pname[MAX_PLAYER_NAME];
  117.                  GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
  118.                  if (perks[playerid][0][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlocked This Perk Yet!!");
  119.                  new str[90];
  120.                  format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][0][2]);
  121.                  if (perks[playerid][0][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
  122.                  if (perkpoints[playerid] < 200) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't have enough points.");
  123.                  SendClientMessage(playerid, COLOR_ORANGE, "You Are Now Immune To Almost Everything in this world");
  124.                  SetPlayerHealth(playerid, 99999);
  125.                  SetTimerEx("EndInvur", 30000, false, "%d", playerid);
  126.                  dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 200);
  127.                  perkpoints[playerid] -= 200;
  128.                  perks[playerid][0][2] = 180;
  129.                  perkcd[playerid][0] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
  130.                  perks[playerid][0][1] = 1;
  131.                 }
  132.                 case 1:
  133.                 {
  134.                  new pname[MAX_PLAYER_NAME];
  135.                  GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
  136.                  if(perks[playerid][1][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlokced This Perk Yet!!");
  137.                  if(perkpoints[playerid] < 120) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Enough Points!");
  138.                  new str[90];
  139.                  format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][1][2]);
  140.                  if(perks[playerid][1][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
  141.                  dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 120);
  142.                  perkpoints[playerid] = perkpoints[playerid] - 120;
  143.                  SetPlayerHealth(playerid, 200);
  144.                  SetPlayerArmour(playerid, 300);
  145.                  SetPlayerSkin(playerid, 149);
  146.                  GivePlayerWeapon(playerid, 38, 1500);
  147.                  perks[playerid][1][1] = 1;
  148.                  perks[playerid][1][2] = 300;
  149.                  perkcd[playerid][2] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
  150.                  SendClientMessage(playerid, COLOR_ORANGE, "PERK ACTIVATED: Juggernaut Mode!! Your Health And Armoured Has Been Boosted To A Huge Degreee.");
  151.                 }
  152.                 case 2:
  153.                 {
  154.                  new pname[MAX_PLAYER_NAME], rhm[64], rhm1[12];
  155.                  GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
  156.                  if(perks[playerid][2][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlocked This Perk Yet!!");
  157.                  new str[90];
  158.                  format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][2][2]);
  159.                  if(perks[playerid][2][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
  160.                  if(perkpoints[playerid] < 50) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Enough Points!");
  161.                  SetTimer("EndRegenTimer", 50000, false);
  162.                  perkregentimer[playerid] = SetTimerEx("RegeneratePlayerHealth", 2000, true, "%i", playerid);
  163.                  dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 50);
  164.                  perkpoints[playerid] -= 50;
  165.                  perks[playerid][2][1] = 1;
  166.                  perks[playerid][2][2] = 60;
  167.                  perkcd[playerid][2] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
  168.                  if(perks[playerid][2][0] == 1)
  169.                     {
  170.                      format(rhm, sizeof(rhm), "Your Health Will Start Regenerating A Small Amount Overtime.");
  171.                      SendClientMessage(playerid, COLOR_WHITE, rhm);
  172.                     }
  173.                  else if(perks[playerid][2][0] == 2)
  174.                     {
  175.                      rhm1 = "Average";
  176.                      format(rhm, sizeof(rhm), "Your Health Will Start Regenerate An Average Amount Overtime.");
  177.                      SendClientMessage(playerid, COLOR_WHITE, rhm);
  178.                     }
  179.                  else if(perks[playerid][2][0] == 3)
  180.                     {
  181.                      rhm1 = "Large";
  182.                      format(rhm, sizeof(rhm), "Your Health Will Start Regenerate A Large Amount Overtime.");
  183.                      SendClientMessage(playerid, COLOR_WHITE, rhm);
  184.                     }
  185.                  else if(perks[playerid][2][0] == 4)   
  186.                     {                
  187.                      rhm1 = "Massive";
  188.                      format(rhm, sizeof(rhm), "Your Health Will Start Regenerate A Massive Amount Overtime.");
  189.                      SendClientMessage(playerid, COLOR_WHITE, rhm);
  190.                     }
  191.                 }
  192.                 case 3:
  193.                 {
  194.                  new pname[MAX_PLAYER_NAME];
  195.                  if(perks[playerid][3][0] == 0) return SendClientMessage(playerid, COLOR_RED, "Error: You Haven't Unlokced This Perk Yet!!");
  196.                  if(perkpoints[playerid] < 75) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Enough Points!");
  197.                  new str[90];
  198.                  format(str, sizeof(str), "Error: Your Perk is Cooling Down, Wait For %i Seconds Until It is Usable Again.", perks[playerid][3][2]);
  199.                  if(perks[playerid][3][1] == 1) return SendClientMessage(playerid, COLOR_RED, str);
  200.                  GetPlayerName(playerid, pname, sizeof(pname));
  201.                  dini_IntSet(FileDirectory(accounts, pname), "perkpoints", perkpoints[playerid] - 75);
  202.                  perkpoints[playerid] = perkpoints[playerid] - 75;
  203.                  perks[playerid][3][1] = 1;
  204.                  perks[playerid][3][2] = 40;
  205.                  perkcd[playerid][3] = SetTimerEx("PerkCoolDown", 1000, true, "%i%i", playerid, listitem);
  206.                  SendClientMessage(playerid, COLOR_YELLOW, "You Have Stunned All Nearby Players.");
  207.                  for(new i = 0; i > MAX_PLAYERS ; i++)
  208.                  {
  209.                     if(!IsPlayerConnected(i) || i == playerid) continue;
  210.                     new Float:x, Float:y, Float:z;
  211.                     GetPlayerPos(playerid, x, y, z);
  212.                     if(!IsPlayerInRangeOfPoint(i, 10, x, y, z)) continue;
  213.                     if(IsPlayerInAnyVehicle(i)) return TogglePlayerControllable(i, 0);
  214.                     ApplyAnimation(i, "ped", "FALL_collapse", 4.1, 0, 1, 1, 0, 7500, 0);
  215.                     perks[playerid][3][3] = SetTimerEx("StunEnd", 8000, 0, "%i%i", playerid, i);
  216.                     TogglePlayerControllable(i, 0);
  217.                     GameTextForPlayer(i, "~r~You Have Been Stunned!!", 3000, 5);
  218.                  }
  219.                    
  220.                 }
  221.             }
  222.             return 1;
  223.        }
  224.        return 0;
  225.     }
  226.     return 1;
  227. }
  228.  
  229. /* Commands */
  230. CMD:perks(playerid, params[])
  231. {
  232.     new perktitle[256], pname[MAX_PLAYER_NAME];
  233.     GetPlayerName(playerid, pname, sizeof(pname));
  234.     if(perkpoints[playerid]<=0) return SendClientMessage(playerid, COLOR_RED, "Error: You Don't Have Any Perks Points");
  235.     format(perktitle, sizeof(perktitle), "Choose Your Perk!!   Current Points: %d", perkpoints[playerid]);
  236.     ShowPlayerDialog(playerid, DIALOG_PERKS, DIALOG_STYLE_TABLIST_HEADERS, perktitle, "Perk\tCost\tMain Effect\nUntouchable\t200 Points\tTemporary Invurability\nJuggernaut\t120 Points\tSuper Heavy Armour\nRecovering\t50 Points\tRegenerate Health\nShockwave\t75 Points\tStun Players", "Activate", "Cancel");
  237.     return 1;
  238. }
  239. CMD:setperkpoints(playerid, params[])
  240. {
  241.     new giveplayerid, moneys1, giveplayer[25], string[256];
  242.     if (sscanf(params, "ud", giveplayerid, moneys1)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /setperkpoints [playerid] [level 0-10000]");
  243.     if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
  244.     if (moneys1 < 0 || moneys1 > 10000) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid amount.");
  245.     GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
  246.     if (moneys1 == perkpoints[giveplayerid])
  247.     {
  248.         format(string, 64, "%s has %d points already.", giveplayer, moneys1);
  249.         SendClientMessage(playerid, COLOR_WHITE, string);
  250.         return 1;
  251.     }
  252.     dini_IntSet(FileDirectory(accounts, giveplayer), "perkpoints", moneys1);
  253.     perkpoints[giveplayerid] = moneys1;
  254.     format(string, 64, "Your perk points has been set to %d.", moneys1);
  255.     SendClientMessage(giveplayerid, COLOR_YELLOW, string);
  256.     format(string, 64, "You set %s points to %d.", giveplayer, moneys1);
  257.     SendClientMessage(playerid, COLOR_YELLOW, string);
  258.     return 1;
  259. }
  260. CMD:setplevel(playerid, params[])
  261. {
  262.     new pname[MAX_PLAYER_NAME], moneys1, moneys2, giveplayerid, rgl, str[90];
  263.     if (sscanf(params, "uid", giveplayerid, moneys1, moneys2)) return SendClientMessage(playerid, -1, "Usage: /setpplevel [playerid] [perkid] [level]");
  264.     GetPlayerName(giveplayerid, pname, MAX_PLAYER_NAME);
  265.     if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid player id!");
  266.     if (moneys1 < 0 || moneys1 > 3) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid Perk ID!!");
  267.     if (moneys2 < 0 || moneys2 > 5) return SendClientMessage(playerid, COLOR_RED, "Error: Invalid Level!! Choose Between 0-5");
  268.     if (moneys1 == 2 && moneys2 > 4) return SendClientMessage(playerid, COLOR_RED, "Error: Regen Perk Level Range 0-4");
  269.     if ((moneys1 == 1 || moneys1 == 0) && moneys2 > 1) return SendClientMessage(playerid, COLOR_RED, "Error: Perk Level Range 0 - 1");
  270.     if (moneys1 == 2)
  271.     {
  272.         rgl = dini_Int(FileDirectory(accounts, pname), "regenlevel");
  273.         if (moneys2 == rgl)
  274.         {
  275.            format(str, sizeof(str), "Error: %s's Regeneration Level is already %i.", pname, moneys2);
  276.            SendClientMessage(playerid, COLOR_WHITE, str);
  277.         }
  278.         else if(rgl == 0)
  279.         {
  280.            new str1[90];
  281.            new str2[90];
  282.            format(str2, sizeof(str2), "An Admin has Unlocked Regeneration Perk For You, Your Level Has Been Set To %i.", moneys2);
  283.            dini_IntSet(FileDirectory(accounts, pname), "regenlevel", moneys2);
  284.            format(str1, sizeof(str1), "You Have Unlocked Regeneration Perk For %s and Has Set its level to %i.", pname, moneys2);
  285.            SendClientMessage(playerid, COLOR_GREEN, str1);
  286.            SendClientMessage(giveplayerid, COLOR_GREEN, str2);
  287.            perks[playerid][2][0] = moneys2;
  288.         }
  289.         else if(moneys2 == 0)
  290.         {
  291.            new str1[90];
  292.            new str2[90];
  293.            format(str1, sizeof(str1), "You Have locked Regeneration Perk For %s.", pname);
  294.            format(str2, sizeof(str2), "An Admin Has Disabled Your Regeneration Perk.");
  295.            dini_IntSet(FileDirectory(accounts, pname), "regenlevel", moneys2);
  296.            SendClientMessage(playerid, COLOR_YELLOW, str1);
  297.            SendClientMessage(giveplayerid, COLOR_YELLOW, str2);
  298.            perks[playerid][2][0] = moneys2;
  299.         }
  300.         else
  301.         {
  302.            new str1[90];
  303.            new str2[90];
  304.            format(str1, sizeof(str1), "You Have Set Regeneration Perk Level For %s to level %i.", pname, moneys2);
  305.            format(str2, sizeof(str2), "Your Regeneration Perk Level has been set %i by an admin.", moneys2);
  306.            SendClientMessage(playerid, COLOR_YELLOW, str1);
  307.            SendClientMessage(giveplayerid, COLOR_YELLOW, str2);
  308.            dini_IntSet(FileDirectory(accounts, pname), "regenlevel", moneys2);
  309.            perks[playerid][2][0] = moneys2;
  310.         }
  311.     }
  312.     new inv1[64], inv2[64], inv3[64], inv4[64];
  313.     format(inv1, sizeof(inv1), "Invurnability Perk Is Already Locked For %s", pname);
  314.     format(inv2, sizeof(inv2), "Invurability Perk Is Already Unlocked For %s", pname);
  315.     if (moneys1 == 0 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "invur") == 0) return SendClientMessage(playerid, COLOR_WHITE, inv1);
  316.     if (moneys1 == 0 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "invur") == 1) return SendClientMessage(playerid, COLOR_WHITE, inv2);
  317.     if (moneys1 == 0 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "invur") == 1)
  318.     {
  319.         dini_IntSet(FileDirectory(accounts, pname), "invur", moneys2);
  320.         format(inv3, sizeof(inv3), "You Have Locked %s's Invurability Perk.", pname);
  321.         SendClientMessage(playerid, COLOR_YELLOW, inv3);
  322.         SendClientMessage(giveplayerid, COLOR_YELLOW, "An Admin Has Locked Your Invurability Perk.");
  323.         perks[giveplayerid][0][0] = 0;
  324.     }
  325.     if (moneys1 ==0 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "invur") == 0)
  326.     {
  327.         format(inv4, sizeof(inv4), "You Have Given %s Invurability Perk.", pname);
  328.         dini_IntSet(FileDirectory(accounts, pname), "invur", moneys2);
  329.         SendClientMessage(playerid, COLOR_GREEN, inv4);
  330.         SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Given You Invurability Perk.");
  331.         perks[giveplayerid][0][0] = 1;
  332.     }
  333.     new jugg1[64], jugg2[64], jugg3[64], jugg4[64];
  334.     format(jugg1, sizeof(jugg1), "Juggernaut Perk Is Already Locked For %s", pname);
  335.     format(jugg2, sizeof(jugg2), "Juggernaut Perk Is Already Unlocked For %s", pname);
  336.     if (moneys1 == 1 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "jugg") == 0) return SendClientMessage(playerid, COLOR_WHITE, jugg1);
  337.     if (moneys1 == 1 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "jugg") == 1) return SendClientMessage(playerid, COLOR_WHITE, jugg2);
  338.     if (moneys1 == 1 && moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "jugg") == 1)
  339.     {
  340.         format(jugg3, sizeof(jugg3), "You Have Locked %s's Juggernaut Perk.", pname);
  341.         dini_IntSet(FileDirectory(accounts, pname), "jugg", moneys2);
  342.         SendClientMessage(playerid, COLOR_YELLOW, jugg3);
  343.         SendClientMessage(giveplayerid, COLOR_YELLOW, "An Admin Has Locked Your Juggernaut Perk.");
  344.         perks[giveplayerid][1][0] = 0;
  345.     }
  346.     if (moneys1 == 1 && moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "jugg") == 0)
  347.     {
  348.         format(jugg4, sizeof(jugg4), "You Have Given %s Juggernaut Perk.", pname);
  349.         dini_IntSet(FileDirectory(accounts, pname), "jugg", moneys2);
  350.         SendClientMessage(playerid, COLOR_GREEN, jugg4);
  351.         SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Given You Juggernaut Perk.");
  352.         perks[giveplayerid][1][0] = 1;
  353.     }
  354.     if (moneys1 == 3)
  355.     {
  356.         new stun1[90], stun2[90], stun3[90], stun4[90];
  357.         format(stun1, 90, "Stun Perk Is Already Unlocked For %s.", pname);
  358.         format(stun2, 90, "Stun Perk Is Already Locked For %s.", pname);
  359.         if(moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 1) return SendClientMessage(playerid, COLOR_WHITE, stun1);
  360.         if(moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 0) return SendClientMessage(playerid, COLOR_WHITE, stun2);
  361.         if(moneys2 == 1 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 0)
  362.         {
  363.          format(stun3, 90, "You Have Unlocked Stun Perk For %s.", pname);
  364.          dini_IntSet(FileDirectory(accounts, pname), "stunlevel", moneys2);
  365.          SendClientMessage(playerid, COLOR_GREEN, stun3);
  366.          SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Given You Stun Perk.");
  367.          perks[giveplayerid][3][0] = 1;
  368.         }
  369.         if(moneys2 == 0 && dini_Int(FileDirectory(accounts, pname), "stunlevel") == 1)
  370.         {
  371.          format(stun3, 90, "You Have Locked Stun Perk For %s.", pname);
  372.          dini_IntSet(FileDirectory(accounts, pname), "stunlevel", moneys2);
  373.          SendClientMessage(playerid, COLOR_GREEN, stun4);
  374.          SendClientMessage(giveplayerid, COLOR_GREEN, "An Admin Has Locked Your Stun Perk.");
  375.          perks[giveplayerid][3][0] = 2;
  376.         }
  377.     }
  378.     return 1;
  379. }
  380.  
  381. /* Timers */
  382. forward EndRegenTimer(playerid);
  383. public EndRegenTimer(playerid)
  384. {
  385.    KillTimer(perkregentimer[playerid]);
  386.    SendClientMessage(playerid, COLOR_WHITE, "Health Regeneration Over!");
  387. }
  388.  
  389. forward RegeneratePlayerHealth(playerid);
  390. public  RegeneratePlayerHealth(playerid)
  391. {
  392.     new Float:health;
  393.     GetPlayerHealth(playerid, health);
  394.     switch(perks[playerid][2][0])
  395.     {
  396.         case 1: health = health + 1  > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 1;
  397.         case 2: health = health + 2  > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 2;
  398.         case 3: health = health + 4  > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 4;
  399.         case 4: health = health + 8 > pmaxhealth[playerid] ? pmaxhealth[playerid] : health + 8;
  400.     }
  401.     SetPlayerHealth(playerid, health);
  402. }
  403.  
  404. forward EndInvur(playerid);
  405. public EndInvur(playerid)
  406. {
  407.    SetPlayerHealth(playerid, pmaxhealth[playerid]);
  408.    SendClientMessage(playerid, COLOR_ORANGE, "Your superb damage resistance has ended!");
  409. }
  410.  
  411. forward PerkCoolDown(playerid, perkid);
  412. public PerkCoolDown(playerid, perkid)
  413. {
  414.     new cdend[90], cd1[32];
  415.     switch(perkid)
  416.     {
  417.      case 0: cd1 = "Invurability";
  418.      case 1: cd1 = "Juggernaut";
  419.      case 2: cd1 = "Regeneration";
  420.      case 3: cd1 = "Stun";
  421.     }
  422.     if(perks[playerid][perkid][2] > 0) return perks[playerid][perkid][2] = perks[playerid][perkid][2] - 1;
  423.     else
  424.     {
  425.      KillTimer(perkcd[playerid][perkid]);
  426.      perks[playerid][perkid][2] = 0;
  427.      perks[playerid][perkid][1] = 0;
  428.      format(cdend, sizeof(cdend), "Your %s Perk Cool Down Ended, And Is Ready To Be Used Again.", cd1);
  429.      SendClientMessage(playerid, COLOR_YELLOW, cdend);
  430.     }
  431.     return 1;
  432. }
  433.  
  434. forward StunEnd(playerid, giveplayerid);
  435. public StunEnd(playerid, giveplayerid)
  436. {
  437.     TogglePlayerControllable(giveplayerid, 1);
  438.     perks[giveplayerid][3][3] = 0;
  439. }
Add Comment
Please, Sign In to add comment