Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. #pragma semicolon 1
  2. #pragma newdecls required
  3.  
  4. #include <sdktools>
  5. #include <sdkhooks>
  6.  
  7. #pragma tabsize 0
  8.  
  9. #define MAX_LIST 36
  10.  
  11. static const char gWeapons[MAX_LIST - 18][] =
  12. {
  13. "weapon_autoshotgun",
  14. "weapon_hunting_rifle",
  15. "weapon_pistol",
  16. "weapon_pistol_magnum",
  17. "weapon_pumpshotgun",
  18. "weapon_rifle",
  19. "weapon_rifle_ak47",
  20. "weapon_rifle_desert",
  21. "weapon_rifle_m60",
  22. "weapon_rifle_sg552",
  23. "weapon_shotgun_chrome",
  24. "weapon_shotgun_spas",
  25. "weapon_smg",
  26. "weapon_smg_mp5",
  27. "weapon_smg_silenced",
  28. "weapon_sniper_awp",
  29. "weapon_sniper_military",
  30. "weapon_sniper_scout"
  31. };
  32.  
  33. static const float gDamageForEveryInfected[MAX_LIST] =
  34. {
  35. 21.6,
  36. 128.0,
  37. 40.0,
  38. 215.2,
  39. 75.2,
  40. 148.0,
  41. 173.6,
  42. 240.0,
  43. 26.4,
  44. 46.4,
  45. 42.4,
  46. 62.4,
  47. 46.4,
  48. 80.0,
  49. 120.0,
  50. 152.0,
  51. 28.8,
  52. 36.0,
  53. 108.0, //Head
  54. 200.0,
  55. 62.5,
  56. 336.25,
  57. 117.5,
  58. 231.25,
  59. 271.25,
  60. 375.0,
  61. 132.0,
  62. 72.5,
  63. 66.25,
  64. 97.5,
  65. 72.5,
  66. 125.0,
  67. 187.5,
  68. 237.5,
  69. 144.0,
  70. 180.0
  71. };
  72.  
  73. static const float gDamageTank[MAX_LIST] =
  74. {
  75. 1.0,
  76. 60.8,
  77. 2.8,
  78. 37.7,
  79. 40.0,
  80. 98.4,
  81. 159.5,
  82. 291.0,
  83. 1.0,
  84. 4.4,
  85. 3.3,
  86. 23.4,
  87. 4.4,
  88. 48.0,
  89. 50.2,
  90. 106.4,
  91. 1.8,
  92. 1.8,
  93. 104.0,//Head
  94. 1920.0,
  95. 276.0,
  96. 3228.0,
  97. 1128.0,
  98. 2220.0,
  99. 2604.0,
  100. 3600.0,
  101. 107.0,
  102. 438.0,
  103. 324.0,
  104. 936.0,
  105. 438.0,
  106. 1200.0,
  107. 1800.0,
  108. 2280.0,
  109. 177.0,
  110. 178.0
  111. };
  112.  
  113. static const float gDamageCharger[MAX_LIST] =
  114. {
  115. 216.0,
  116. 400.0,
  117. 125.0,
  118. 672.5,
  119. 235.0,
  120. 462.5,
  121. 542.5,
  122. 750.0,
  123. 264.0,
  124. 145.0,
  125. 132.5,
  126. 195.0,
  127. 145.0,
  128. 250.0,
  129. 375.0,
  130. 475.0,
  131. 288.0,
  132. 360.0,
  133. 27.8, // Head
  134. 256.0,
  135. 74.2,
  136. 430.4,
  137. 150.4,
  138. 296.0,
  139. 347.2,
  140. 480.0,
  141. 28.3,
  142. 92.8,
  143. 84.8,
  144. 124.8,
  145. 92.8,
  146. 160.0,
  147. 240.0,
  148. 304.0,
  149. 47.2,
  150. 47.8
  151. };
  152.  
  153. public void OnClientPutInServer(int client)
  154. {
  155. SDKHook(client, SDKHook_TraceAttack, OnTakeDamage);
  156. }
  157.  
  158. public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
  159. {
  160. if (!(damagetype & DMG_BURN || damagetype & DMG_BLAST))
  161. {
  162. if (IsValidClient(attacker) && GetClientTeam(attacker) != 3)
  163. {
  164. if(IsValidClient(victim) && GetClientTeam(victim) != 2)
  165. {
  166. int iEnt = GetEntPropEnt(attacker, Prop_Send, "m_hUseEntity");
  167. if(IsValidEdict(iEnt) && iEnt > 0)
  168. {
  169. char sWeaponEx[32];
  170. GetEdictClassname(iEnt, sWeaponEx, sizeof(sWeaponEx));
  171. if (StrEqual(sWeaponEx, "prop_minigun") || StrEqual(sWeaponEx, "prop_minigun_l4d1"))
  172. {
  173. return Plugin_Continue;
  174. }
  175. }
  176. char classname[64];
  177. GetClientWeapon(attacker, classname, sizeof(classname));
  178. if(StrEqual(classname, "weapon_melee")) return Plugin_Continue;
  179.  
  180. int vClass = GetEntProp(victim, Prop_Send, "m_zombieClass");
  181. switch(vClass)
  182. {
  183. case 1, 2, 3, 4, 5:
  184. {
  185. for(int i = 0; i < MAX_LIST; i++)
  186. {
  187. if(strcmp(classname, gWeapons[i]) == 0)
  188. {
  189. damage = gDamageForEveryInfected[i];
  190. if(hitgroup == 1)
  191. {
  192. damage = gDamageForEveryInfected[i + 18];
  193. }
  194. break;
  195. }
  196. }
  197. }
  198. case 6:
  199. {
  200. for(int i = 0; i < MAX_LIST; i++)
  201. {
  202. if(strcmp(classname, gWeapons[i]) == 0)
  203. {
  204. damage = gDamageCharger[i];
  205. if(hitgroup == 1)
  206. {
  207. damage = gDamageCharger[i + 18];
  208. }
  209. break;
  210. }
  211. }
  212. }
  213. case 8:
  214. {
  215. for(int i = 0; i < MAX_LIST; i++)
  216. {
  217. if(strcmp(classname, gWeapons[i]) == 0)
  218. {
  219. damage = gDamageTank[i];
  220. if(hitgroup == 1)
  221. {
  222. damage = gDamageTank[i + 18];
  223. }
  224. break;
  225. }
  226. }
  227. }
  228. }
  229. return Plugin_Changed;
  230. }
  231. }
  232. }
  233. return Plugin_Continue;
  234. }
  235.  
  236. public bool IsValidClient(int client)
  237. {
  238. if (client <= 0)
  239. return false;
  240.  
  241. if (client > MaxClients)
  242. return false;
  243.  
  244. if (!IsClientInGame(client))
  245. return false;
  246.  
  247. if (!IsPlayerAlive(client))
  248. return false;
  249.  
  250. return true;
  251. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement