Thread: [Solved] [CS:GO][REQ] Show Damage
View Single Post
Pilo
AlliedModders Donor
Join Date: Jan 2019
Location: Israel
Old 07-28-2019 , 07:51   Re: [CS:GO][REQ] Show Damage
Reply With Quote #5

PHP Code:
#include <sourcemod>

public void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurt);
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
Action Event_PlayerHurt(Event event, const char[] namebool dB)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
int damage event.GetInt("dmg_health");
    
    if (
IsClientInGame(attacker) && IsClientInGame(victim))
    {
        if (!
IsFakeClient(attacker) && !IsFakeClient(victim))
        {
            if (
attacker != victim)
            {
                
PrintHintText(attacker"%i Damage to %N"damagevictim);
            }
        }
    }
    return 
Plugin_Continue;
}

public 
Action Event_PlayerDeath(Event event, const char[] namebool dB)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
    if (
IsClientInGame(attacker) && IsClientInGame(victim))
    {
        if (!
IsFakeClient(attacker) && !IsFakeClient(victim))
        {
            if (
attacker != victim)
            {
                
PrintHintText(attacker"%N Killed"victim);
            }
        }
    }
    return 
Plugin_Continue;

Untested.
__________________

Taking Private(PAID) Plugins In PM
Feel free to Donate with PayPal
Feel free to message me in Discord Pilo#8253
Total donated : 25$
Pilo is offline