How to add here check for ADMIN_LEVEL_H and FIX this public Event_Damage to work like in code under it? I want circle bullet damage for admin, but without showing through walls.
PHP Code:
public Event_Damage( iVictim, pVictim)
{
static pAttacker; pAttacker = get_user_attacker(pVictim);
if(!is_user_connected(pAttacker) || !g_bShowDamage[pAttacker] || !ent_sees_ent(pAttacker, pVictim)) return;
if( get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
{
new id = get_user_attacker(iVictim)
if( (1 <= id <= g_iMaxPlayers) && is_user_connected(id) )
if (get_user_flags(id) & ADMIN_LEVEL_H)
{
new iPos = ++g_iPlayerPos[id]
if( iPos == sizeof(g_flCoords) )
{
iPos = g_iPlayerPos[id] = 0
}
set_hudmessage(random_num(0, 224), random_num(0, 224), random_num(0, 224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1)
show_hudmessage(id, "%d", read_data(2))
}
}
PHP Code:
#include <amxmodx>
#include <engine>
new bool:g_bShowDamage[33];
public plugin_init()
{
register_plugin("Damager only visible", "1.2 RC2", "neygomon");
register_event("Damage", "eDamage", "b", "2!0", "3=0", "4!0");
register_clcmd("say /damager", "ClCmdToggle");
}
public client_putinserver(pClient)
{
new sInfo[4]; get_user_info(pClient, "_dmg", sInfo, charsmax(sInfo));
if(sInfo[0] && equal(sInfo, "on")) g_bShowDamage[pClient] = true;
else g_bShowDamage[pClient] = false;
}
public eDamage(pVictim)
{
static pAttacker; pAttacker = get_user_attacker(pVictim);
if(!is_user_connected(pAttacker) || !g_bShowDamage[pAttacker] || !ent_sees_ent(pAttacker, pVictim)) return;
static SyncHudMsg; if(!SyncHudMsg) SyncHudMsg = CreateHudSyncObj();
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1);
ShowSyncHudMsg(pAttacker, SyncHudMsg, "%i^n", read_data(2));
}
public ClCmdToggle(pClient)
{
if(g_bShowDamage[pClient])
{
ChatColor(pClient, "^3* ^4Bullet damage: ^3OFF^4!");
client_cmd(pClient, "setinfo _dmg off");
g_bShowDamage[pClient] = false;
}
else
{
ChatColor(pClient, "^3* ^4Bullet damage ^3ON^4!");
client_cmd(pClient, "setinfo _dmg on");
g_bShowDamage[pClient] = true;
}
return PLUGIN_HANDLED;
}
stock ChatColor(id, const szMessage[])
{
if(!is_user_connected(id)) return;
static IdMsg; if(!IdMsg) IdMsg = get_user_msgid("SayText")
message_begin(MSG_ONE, IdMsg, .player = id);
write_byte(id);
write_string(szMessage);
message_end();
}
stock bool:ent_sees_ent(iEnt, iEnt2)
{
static Float:fEntOrigin[3], Float:fEnt2Origin[3], Float:fResult[3];
entity_get_vector(iEnt, EV_VEC_origin, fEntOrigin);
entity_get_vector(iEnt2, EV_VEC_origin, fEnt2Origin);
return trace_line(iEnt, fEntOrigin, fEnt2Origin, fResult) == iEnt2;
}