Raised This Month: $32 Target: $400
 8% 

damage to admin level h


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HowToRuski
Senior Member
Join Date: Feb 2019
Location: Hungary
Old 02-09-2019 , 15:41   damage to admin level h
Reply With Quote #1

Can please someone code this to only admin level H?

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 && fm_is_ent_visible(pAttackerid))
    
#else
    
if(is_user_connected(pAttacker) && pAttacker != id && 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))
    {
        
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;

HowToRuski is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-09-2019 , 17:14   Re: damage to admin level h
Reply With Quote #2

Ask here, https://forums.alliedmods.net/forumdisplay.php?f=12
__________________








CrazY. is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 02-10-2019 , 13:49   Re: damage to admin level h
Reply With Quote #3

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;

PartialCloning 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 18:47.


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