Quote:
Originally Posted by midnight9
Is there existing way to get damage done to survivors by tank? Like i just want to get the value
|
Just hook player_hurt post, add the damage inflicted to a variable ( or if you want to be accurate by the float, use SDKHooks ) and retrieve it whenever you wish.
Edit: Here's a script I made for you
. DamageDoneThisLife is the amount of damage the tank did this life ( reset when the tank dies )
DamageDoneThisMap is the amount of damage the tank did this map ( resets in the beginning of every map, doesn't reset if the player is a ************ team swapper )
PHP Code:
#include <sourcemod>
public Plugin:myinfo =
{
name = "[L4D2] Tank Damage Variable",
author = "Eyal282 ( FuckTheSchool )",
description = "[L4D2] Variable that indicates the amount of damage a tank did to the survivors.",
version = "1.0",
url = "https://forums.alliedmods.net/showpost.php?p=2571963&postcount=2"
}
new DamageDoneThisLife[MAXPLAYERS], DamageDoneThisMap[MAXPLAYERS];
public OnMapStart()
{
for(new i=1;i <= MaxClients;i++)
{
DamageDoneThisLife[i] = 0;
DamageDoneThisMap[i] = 0;
}
}
public OnClientConnected(client)
{
DamageDoneThisLife[client] = 0;
DamageDoneThisMap[client] = 0;
}
public OnPluginStart()
{
HookEvent("player_death", ResetDamageDone);
HookEvent("player_hurt", Event_PlayerHurt);
}
public Action:ResetDamageDone(Handle:hEvent, String:Name[], bool:dontBroastcast)
{
new client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
if(!IsPlayer(client))
return;
DamageDoneThisLife[client] = 0;
}
public Action:Event_PlayerHurt(Handle:hEvent, String:Name[], bool:dontBroastcast)
{
new client = GetClientOfUserId(GetEventInt(hEvent, "userid"));
new attacker = GetClientOfUserId(GetEventInt(hEvent, "attacker"));
new damage = GetClientOfUserId(GetEventInt(hEvent, "dmg_health"));
if(!IsPlayer(client) || !IsPlayer(attacker))
return;
else if(GetClientTeam(attacker) != 3 || GetClientTeam(client) != 2)
return;
else if(GetEntProp(attacker, Prop_Send, "m_zombieClass") != 8)
return;
DamageDoneThisLife[attacker] += damage;
DamageDoneThisMap[attacker] += damage;
}
stock IsPlayer(client)
{
if(client < 1 || client > MaxClients)
return false;
else if(!IsClientInGame(client))
return false;
return true;
}