Thread: [Solved] [CS:GO][REQ] Show Damage
View Single Post
trickgod
Junior Member
Join Date: Jun 2018
Old 07-28-2019 , 09:31   Re: [CS:GO][REQ] Show Damage
Reply With Quote #6

Quote:
Originally Posted by Pilo View Post
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.
Killed Hint Text Working But Damage To Hint Text Not Working can you solve ?
trickgod is offline