Raised This Month: $ Target: $400
 0% 

Name above damage hud


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 10-16-2020 , 06:58   Name above damage hud
Reply With Quote #1

So i was wondering if anyone could help me make a name appear WHO you shoot and who shoots you above the damage gets shown?
Like

PHP Code:
Kappa
 49 
And when you shoot someone it appears like that too...

If anyone knows how to do this, could you help me thanks in advance!

PHP Code:
#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

#define USE_CHECK_VISIBLE_ENT // Закомментируйте эту строку, если не хотите использовать проверку видимости игрока перед отображением урона

#if !defined USE_CHECK_VISIBLE_ENT
    #define CONSIDER_MEAT_MAPS // Закомментируйте эту строку, если не хотите принудительно активировать проверку видимости игрока на "мясных" картах
    
    
new bool:g_bMeatMap;
#endif

new g_pHudSyncObj1;
new 
g_pHudSyncObj2;

public 
plugin_init()
{
    
register_plugin("Damager""0.1b""Subb98");
    
register_event("Damage""EventDamage""b""2!0""3=0""4!0");
    
g_pHudSyncObj1 CreateHudSyncObj();
    
g_pHudSyncObj2 CreateHudSyncObj();
}

#if defined CONSIDER_MEAT_MAPS
public plugin_cfg()
{
    new const 
szMapTypes[][] = {"aim_""awp_""fy_"}; // Типы карт, которые будут считаться "мясными" (по умолчанию "aim_", "awp_", "fy_")
    
new szMapname[32];
    
get_mapname(szMapnamecharsmax(szMapname));
    for(new 
isizeof szMapTypesi++)
    {
        if(
equali(szMapnameszMapTypes[i], strlen(szMapTypes[i])))
        {
            
g_bMeatMap true;
            break;
        }
    }
}
#endif

public EventDamage(const id)
{
    static 
pAttackeriDamage;
    
pAttacker get_user_attacker(id), iDamage read_data(2);
    
#if defined USE_CHECK_VISIBLE_ENT
    
if(is_user_connected(pAttacker) && pAttacker != id && get_user_flags(pAttacker) & ADMIN_LEVEL_H && fm_is_ent_visible(pAttackerid))
    
#else
    
if(is_user_connected(pAttacker) && pAttacker != id && get_user_flags(pAttacker) & ADMIN_LEVEL_H && g_bMeatMap fm_is_ent_visible(pAttackerid) : 1>0)
    
#endif
    
{
        
set_hudmessage(0_200_0.55__1.0_0.0, -1);
        
ShowSyncHudMsg(pAttackerg_pHudSyncObj1"%d"iDamage);
    }
    if(
is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
set_hudmessage(2550_0.45, -1.0__1.0_0.0, -1);
        
ShowSyncHudMsg(idg_pHudSyncObj2"%s%d"id == pAttacker "-" ""iDamage);
    }
}

// Thanks to ConnorMcLeod (https://forums.alliedmods.net/showpost.php?p=1580992&postcount=10)
stock bool:fm_is_ent_visible(const id, const pEnt, const bool:bIgnoreMonsters false)
{
    new 
Float:fStart[3], Float:fDestination[3], Float:fFraction;
    
pev(idpev_originfStart);
    
pev(idpev_view_ofsfDestination);
    
fStart[0] += fDestination[0];
    
fStart[1] += fDestination[1];
    
fStart[2] += fDestination[2];
    
pev(pEntpev_originfDestination);
    
engfunc(EngFunc_TraceLinefStartfDestinationbIgnoreMonstersid0);
    
get_tr2(0TR_flFractionfFraction);
    if(
fFraction 0.97)
    {
        return 
true;
    }
    return 
false;


Last edited by HowToRuski; 10-16-2020 at 07:05.
HowToRuski is offline
 



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 13:45.


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