Advertisement
Guest User

Tazer

a guest
Feb 18th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.70 KB | None | 0 0
  1. //Спешал фор про павн. Кто сольёт,говно сожрёт
  2. //====================================================
  3. #define FILTERSCRIPT
  4. #include <a_samp>
  5. #include <ZCMD>
  6.  
  7. //====================================================
  8.  
  9. #define COLOR_WHITE 0xFFFFFFAA
  10. #define COLOR_FADE 0xC8C8C8C8
  11. #define COLOR_GREY 0xAFAFAFAA
  12. #define COLOR_PURPLE 0xC2A2DAAA
  13. #define COLOR_YELLOW 0xDABB3E00
  14. #define COLOR_BLACK 0x000000AA
  15. #define COLOR_BLUE 0x1E90FFAA
  16. #define COLOR_PINK 0xFF1493AA
  17. #define COLOR_GREEN 0x006400AA
  18. #define COLOR_ORANGE 0xFF4500AA
  19. #define COLOR_RED 0xFF0000AA
  20.  
  21. //====================================================
  22.  
  23. new HasTazer[MAX_PLAYERS], BeenTazered[MAX_PLAYERS], WEAPON;
  24.  
  25. forward BeenTazeredTimer(playerid, issuerid, damagedid);
  26. forward OnPlayerChangeWeapon(playerid, oldweapon, newweapon);
  27.  
  28. public BeenTazeredTimer(playerid, issuerid, damagedid)
  29. {
  30.     BeenTazered[playerid] = 1;
  31. }
  32.  
  33. public OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
  34. {
  35.     if(HasTazer[playerid] == 1)
  36.     {
  37.         GivePlayerWeapon(playerid, 23, 5000000); // If player tries changing weapon with a tazer, gives him back the tazer weapon.
  38.     }
  39.     return 1;
  40. }
  41.  
  42. stock GetName(playerid)
  43. {
  44.     new Name[MAX_PLAYER_NAME];
  45.     if(IsPlayerConnected(playerid))
  46.     {
  47.         GetPlayerName(playerid, Name, sizeof(Name));
  48.     }
  49.     return Name;
  50. }
  51.  
  52. stock GiveTazer(playerid)
  53. {
  54.     GivePlayerWeapon(playerid, 23, 5000000); // UNLIMITED AMMUNITION
  55.     HasTazer[playerid] = 1;
  56.     SendClientMessage(playerid, COLOR_WHITE, "INFO: Tazer switched: [ON]");
  57. }
  58.  
  59. stock TakeTazer(playerid)
  60. {
  61.     HasTazer[playerid] = 0;
  62.     SendClientMessage(playerid, COLOR_WHITE, "INFO: Tazer switched: [OFF]");
  63. }
  64.  
  65. //====================================================
  66.  
  67. public OnFilterScriptInit()
  68. {
  69.     print("");
  70.     return 1;
  71. }
  72.  
  73. public OnFilterScriptExit()
  74. {
  75.     return 1;
  76. }
  77.  
  78. main()
  79. {
  80. }
  81.  
  82. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
  83. {
  84.     new string[128];
  85.     new Float:health = GetPlayerHealth(playerid, health);
  86.     if(HasTazer[issuerid] == 1) // Checks if the player has been shot by a player with a tazer in-hand.
  87.     {
  88.         SetPlayerHealth(playerid, health);
  89.         ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
  90.         format(string,sizeof(string),"INFO: You have just been tazered by %s", GetName(issuerid));
  91.         SendClientMessage(playerid, COLOR_WHITE, string);
  92.         SetTimer("BeenTazeredTimer", 6000, 0);
  93.     }
  94.     return 1;
  95. }
  96.  
  97. public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
  98. {
  99.     new string[128];
  100.     if(HasTazer[playerid] == 1) // Checks if the player who gives the damage has a tazer in-hand.
  101.     {
  102.         format(string,sizeof(string),"INFO: You have just fired a tazer-shot and hit %s.", GetName(damagedid));
  103.         SendClientMessage(playerid, COLOR_WHITE, string);
  104.     }
  105.     return 1;
  106. }
  107.  
  108. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  109. {
  110.     return 1;
  111. }
  112.  
  113. //====================================================
  114.  
  115.  
  116. COMMAND:getup(playerid, params[])
  117. {
  118.     switch ( BeenTazered[playerid] )
  119.     {
  120.         case 0: // If the players tazer timer is expired.
  121.         {
  122.             ApplyAnimation(playerid,"PED","getup",4.0,0,0,0,0,0);
  123.         }
  124.         case 1: { SendClientMessage(playerid, COLOR_GREY, "INFO: You must wait a 60 second time period before using this command."); }
  125.     }
  126.     return 1;
  127. }
  128.  
  129. COMMAND:tazer(playerid, params[])
  130. {
  131.     new weapons[13][2];
  132.     for (new i = 0; i < 13; i++)
  133.     {
  134.         GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
  135.     }
  136.     if(weapons[2][0] == 23) { WEAPON = 23; }
  137.     if(HasTazer[playerid] == 0)
  138.     {
  139.         GiveTazer(playerid);
  140.     }
  141.     else
  142.     {
  143.         TakeTazer(playerid);
  144.         GivePlayerWeapon(playerid, WEAPON, 100);
  145.     }
  146.     return 1;
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement