FlacoBey

Untitled

Jan 9th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. public OnPluginStart()
  5. {
  6.     HookEvent("infected_hurt", _DM_InfectedHurt_Event);
  7. }
  8.  
  9. public Action:_DM_InfectedHurt_Event(Handle:event, const String:name[], bool:dontBroadcast)
  10. {
  11.     new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
  12.     new entity = GetEventInt(event, "entityid");
  13.     new damagetype = GetEventInt(event, "type");
  14.     new dmg_health = GetEventInt(event, "dmg_health");
  15.     new eventhealth = GetEventInt(event, "health");
  16.    
  17.     if(damagetype == 128)
  18.     {
  19.         float current[3];
  20.         GetEntPropVector(entity, PropType:1, "m_vecOrigin", current, 0);
  21.         current[0] += 4;
  22.         current[0] += 4;
  23.         TeleportEntity(entity, current, NULL_VECTOR, NULL_VECTOR);
  24.        
  25.         SetEventInt(event, "amount", 0);
  26.         SetEntProp(entity, Prop_Data, "m_iHealth", 52);
  27.     }
  28.     else
  29.     {
  30.         char weaponname[32];
  31.         GetClientWeapon(attacker, weaponname, sizeof(weaponname));
  32.         int damage = (dmg_health * 0) + 25;
  33.         int health = eventhealth - damage;
  34.    
  35.         SetEntProp(entity, Prop_Data, "m_iHealth", health);
  36.         SetEventInt(event, "dmg_health", damage);
  37.         SetEventInt(event, "health", health);
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment