Facebook
From SnowWolf, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 207
  1. #include <sdkhooks>
  2.  
  3. public OnClientPutInServer(client)
  4. {
  5. SDKHook(client, SDKHook_OnTakeDamage, Event_OnTakeDamage);
  6. }
  7.  
  8. public Action:Event_OnTakeDamage(victim, &attacker, &inflictor, &Float:fDamage, &damagetype, &bweapon, Float:damageForce[3], Float:damagePosition[3])
  9. {
  10. decl String:sClassname[64];
  11. GetEdictClassname(inflictor, sClassname, sizeof(sClassname));
  12. if(StrContains(sClassname, "hegrenade", false) == -1)
  13. {
  14. return Plugin_Continue;
  15. }
  16.  
  17. if(victim && attacker)  //make sure they are both clients
  18. {
  19. if(GetClientTeam(victim) == GetClientTeam(attacker))
  20. {
  21. new iNewVal, iCurrentVal;
  22. iCurrentVal = GetEntProp(victim, Prop_Send, "m_iHealth");
  23. iNewVal = RoundFloat(float(iCurrentVal) + fDamage);
  24. if(iNewVal > 100)
  25. {
  26. iNewVal = 100;
  27. }
  28. SetEntProp(victim, Prop_Send, "m_iHealth", iNewVal);
  29.  
  30. /*iCurrentVal = GetEntProp(victim, Prop_Send, "m_ArmorValue");
  31. iNewVal = RoundFloat(float(iCurrentVal) + fDamage);
  32. if(iNewVal > 100)
  33. {
  34. iNewVal = 100;
  35. }
  36. iNewVal = RoundFloat(float(iCurrentVal + fDamage));
  37. SetEntProp(victim, Prop_Send, "m_ArmorValue", iNewVal);*/
  38.  
  39. fDamage = 0.0;
  40. return Plugin_Changed;
  41. }
  42. }
  43.  
  44. return Plugin_Continue;
  45. }