Facebook
From SnowWolf, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 254
  1. #pragma semicolon 1
  2. #include <sourcemod>
  3.  
  4.  
  5. public void OnPluginStart()
  6. {
  7. HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Pre);
  8. }
  9.  
  10. public Action Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast)
  11. {
  12. int victim = GetClientOfUserId(GetEventInt(event, "userid"));
  13. int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  14.  
  15. if (!victim || !attacker || victim > MaxClients || attacker > MaxClients)
  16. return Plugin_Continue;
  17. if (GetClientTeam(victim) != GetClientTeam(attacker))
  18. return Plugin_Continue;
  19.  
  20. int health = GetEventInt(event, "health");
  21. int armor = GetEventInt(event, "armor");
  22. int dmg_health = GetEventInt(event, "dmg_health");
  23. int dmg_armor = GetEventInt(event, "dmg_armor");
  24. char weapon[32];
  25. GetEventString(event, "weapon", weapon, sizeof(weapon));
  26.  
  27. if(StrContains(weapon, "hegrenade", false) == -1)
  28. return Plugin_Continue;
  29. if (dmg_health > 0)
  30. SetEntProp(victim, Prop_Send, "m_iHealth", (health + dmg_health + dmg_health), 4);
  31. if (dmg_armor > 0)
  32. SetEntProp(victim, Prop_Send, "m_ArmorValue", (armor + dmg_armor + dmg_armor), 4);
  33.  
  34. return Plugin_Continue;
  35. }