Twiix

Twiix Scripts - OnPlayerTakeDamage

Sep 20th, 2016
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. /*
  2. _______ _ _ _____ _ _
  3. |__ __| (_|_) / ____| (_) | |
  4. | |_ ___ ___ __ | (___ ___ _ __ _ _ __ | |_ ___
  5. | \ \ /\ / / | \ \/ / \___ \ / __| '__| | '_ \| __/ __|
  6. | |\ V V /| | |> < ____) | (__| | | | |_) | |_\__ \
  7. |_| \_/\_/ |_|_/_/\_\ |_____/ \___|_| |_| .__/ \__|___/
  8. | |
  9. |_|
  10.  
  11. _________________________________________________________________________________________________________________
  12.  
  13. ____ _____ _ _______ _ _____
  14. / __ \ | __ \| | |__ __| | | | __ \
  15. | | | |_ __ | |__) | | __ _ _ _ ___ _ __| | __ _| | _____| | | | __ _ _ __ ___ __ _ __ _ ___
  16. | | | | '_ \| ___/| |/ _` | | | |/ _ \ '__| |/ _` | |/ / _ \ | | |/ _` | '_ ` _ \ / _` |/ _` |/ _ \
  17. | |__| | | | | | | | (_| | |_| | __/ | | | (_| | < __/ |__| | (_| | | | | | | (_| | (_| | __/
  18. \____/|_| |_|_| |_|\__,_|\__, |\___|_| |_|\__,_|_|\_\___|_____/ \__,_|_| |_| |_|\__,_|\__, |\___|
  19. __/ | __/ |
  20. |___/ |___/
  21.  
  22. _________________________________________________________________________________________________________________
  23.  
  24.  
  25. _____ _
  26. / ____| | |
  27. | | ___ _ __ ___ _ __ ___ __ _ _ __ __| |___
  28. | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
  29. | |___| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
  30. \_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/
  31.  
  32. _________________________________________________________________________________________________________________
  33.  
  34. | /hitsound | Enable/Disable Hitsound |
  35. | /shottext | Enable/Disable The Shottext |
  36. | /headshot | Enable/Disable HeadShot (RCON) |
  37.  
  38. _________________________________________________________________________________________________________________
  39. */
  40.  
  41.  
  42.  
  43. #include <a_samp>
  44. #include <zcmd>
  45.  
  46. #define RED 0xAA3333AA
  47.  
  48. new Hitsound[MAX_PLAYERS];
  49. new ShotText[MAX_PLAYERS];
  50. new HeadShot;
  51.  
  52. public OnFilterScriptInit()
  53. {
  54. print("\n-------------------------------------------");
  55. print("Twiix Scripts - OnPlayerTakeDamage - Loaded");
  56. print("-------------------------------------------\n");
  57. return 1;
  58. }
  59.  
  60. public OnFilterScriptExit()
  61. {
  62. print("\n---------------------------------------------");
  63. print("Twiix Scripts - OnPlayerTakeDamage - Unloaded");
  64. print("---------------------------------------------\n");
  65. return 1;
  66. }
  67.  
  68. public OnPlayerSpawn(playerid)
  69. {
  70. Hitsound[playerid] = 1;
  71. ShotText[playerid] = 1;
  72. GivePlayerWeapon(playerid, 26, 999999); //For Test
  73. return 1;
  74. }
  75.  
  76. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
  77. {
  78. if(issuerid != INVALID_PLAYER_ID)
  79. {
  80. if(ShotText[issuerid] == 1)
  81. {
  82. new
  83. string[1024],
  84. WeaponName[24],
  85. ShootedName[MAX_PLAYER_NAME],
  86. ShooterName[MAX_PLAYER_NAME];
  87.  
  88. GetPlayerName(playerid, ShootedName, sizeof (ShootedName)); //To get the shooted player name from his id
  89. GetPlayerName(issuerid, ShooterName, sizeof (ShooterName)); //To get the shooter player name from his id
  90.  
  91. GetWeaponName(weaponid, WeaponName, sizeof (WeaponName)); //To get the weapon name from the weaponid
  92.  
  93. format(string, sizeof(string), "~r~%s~w~(%d)~n~- %.0f ~r~Health/Armor~n~~r~Weapon: ~w~%s", ShootedName, playerid, amount, WeaponName);
  94. GameTextForPlayer(issuerid, string, 5000, 4); //Show the shottext to the player
  95.  
  96. }
  97.  
  98. if(Hitsound[issuerid] == 1)
  99. {
  100. PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0); //Hitsound
  101. }
  102. }
  103.  
  104. if(HeadShot == 1)
  105. {
  106. if(issuerid != INVALID_PLAYER_ID && bodypart == 9) //HeadShot
  107. {
  108. SetPlayerHealth(playerid, 0);
  109. }
  110. }
  111. return 1;
  112. }
  113.  
  114. CMD:hitsound(playerid, params[])
  115. {
  116. if(Hitsound[playerid] == 0)
  117. {
  118. Hitsound[playerid] = 1;
  119. GameTextForPlayer(playerid, "~r~Hitsound ~w~on", 5000, 3);
  120. }
  121.  
  122. else if(Hitsound[playerid] == 1)
  123. {
  124. Hitsound[playerid] = 0;
  125. GameTextForPlayer(playerid, "~r~Hitsound ~w~off", 5000, 3);
  126. }
  127. return 1;
  128. }
  129.  
  130. CMD:shottext(playerid, params[])
  131. {
  132. if(ShotText[playerid] == 0)
  133. {
  134. ShotText[playerid] = 1;
  135. GameTextForPlayer(playerid, "~r~ShotText ~w~on", 5000, 3);
  136. }
  137.  
  138. else if(ShotText[playerid] == 1)
  139. {
  140. ShotText[playerid] = 0;
  141. GameTextForPlayer(playerid, "~r~ShotText ~w~off", 5000, 3);
  142. }
  143. return 1;
  144. }
  145.  
  146. CMD:headshot(playerid, params[])
  147. {
  148. if (! IsPlayerAdmin(playerid))
  149. {
  150. return SendClientMessage(playerid, RED, "You are not RCON Administrator");
  151. }
  152.  
  153. if(HeadShot == 0)
  154. {
  155. HeadShot = 1;
  156. GameTextForPlayer(playerid, "~r~HeadShot ~w~on", 5000, 3);
  157. }
  158.  
  159. else if(HeadShot == 1)
  160. {
  161. HeadShot = 0;
  162. GameTextForPlayer(playerid, "~r~HeadShot ~w~off", 5000, 3);
  163. }
  164. return 1;
  165. }
Advertisement
Add Comment
Please, Sign In to add comment