Raised This Month: $51 Target: $400
 12% 

[L4D2] Damage done to survivors by Tank


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
midnight9
Senior Member
Join Date: Nov 2012
Old 01-14-2018 , 10:12   [L4D2] Damage done to survivors by Tank
Reply With Quote #1

Is there existing way to get damage done to survivors by tank? Like i just want to get the value
midnight9 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-14-2018 , 14:37   Re: [L4D2] Damage done to survivors by Tank
Reply With Quote #2

Quote:
Originally Posted by midnight9 View Post
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;<= 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:hEventString:Name[], bool:dontBroastcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    
    if(!
IsPlayer(client))
        return;
        
    
DamageDoneThisLife[client] = 0;
}

public 
Action:Event_PlayerHurt(Handle:hEventString: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) != || GetClientTeam(client) != 2)
        return;
        
    else if(
GetEntProp(attackerProp_Send"m_zombieClass") != 8)
        return;
        
    
DamageDoneThisLife[attacker] += damage;
    
DamageDoneThisMap[attacker] += damage;
    
}

stock IsPlayer(client)
{
    if(
client || client MaxClients)
        return 
false;
        
    else if(!
IsClientInGame(client))
        return 
false;
    
    return 
true;


Last edited by eyal282; 01-14-2018 at 15:49.
eyal282 is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 01-14-2018 , 17:07   Re: [L4D2] Damage done to survivors by Tank
Reply With Quote #3

You could try using the m_checkpointDamageToTank variable not sure if Prop_Send or Prop_Data. Very likely that it only shows the damage dealt from Saferoom to Saferoom and is probably reset after loading screen.

There is also a m_checkpointDamageToWitch in case you need it.

Edit: misread it. Though there is m_checkpointPZTankDamage but it might only work on VS.

Last edited by xerox8521; 01-14-2018 at 17:09.
xerox8521 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 01-14-2018 , 17:48   Re: [L4D2] Damage done to survivors by Tank
Reply With Quote #4

Quote:
Originally Posted by xerox8521 View Post
You could try using the m_checkpointDamageToTank variable not sure if Prop_Send or Prop_Data. Very likely that it only shows the damage dealt from Saferoom to Saferoom and is probably reset after loading screen.

There is also a m_checkpointDamageToWitch in case you need it.

Edit: misread it. Though there is m_checkpointPZTankDamage but it might only work on VS.
Yea its probably that i will see if i can figure out how to use this, thanks.

Quote:
Originally Posted by eyal282 View Post
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;<= 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:hEventString:Name[], bool:dontBroastcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    
    if(!
IsPlayer(client))
        return;
        
    
DamageDoneThisLife[client] = 0;
}

public 
Action:Event_PlayerHurt(Handle:hEventString: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) != || GetClientTeam(client) != 2)
        return;
        
    else if(
GetEntProp(attackerProp_Send"m_zombieClass") != 8)
        return;
        
    
DamageDoneThisLife[attacker] += damage;
    
DamageDoneThisMap[attacker] += damage;
    
}

stock IsPlayer(client)
{
    if(
client || client MaxClients)
        return 
false;
        
    else if(!
IsClientInGame(client))
        return 
false;
    
    return 
true;

Awesome! Thanks! If i fail to figure out how to use m_checkpointPZTankDamage will likely use your code.
Regards
midnight9 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode