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

Bullet Damage [VIP]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sanimare
Senior Member
Join Date: Sep 2010
Old 03-10-2018 , 13:11   Bullet Damage [VIP]
Reply With Quote #1

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_DamageiVictimpVictim)
{
    static 
pAttackerpAttacker get_user_attacker(pVictim);
    if(!
is_user_connected(pAttacker) || !g_bShowDamage[pAttacker] || !ent_sees_ent(pAttackerpVictim)) return;
    if( 
get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
    {
        new 
id get_user_attacker(iVictim)
        if( (
<= 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(0224), random_num(0224), random_num(0224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.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"sInfocharsmax(sInfo));
    if(
sInfo[0] && equal(sInfo"on")) g_bShowDamage[pClient] = true;
    else 
g_bShowDamage[pClient] = false;
}

public 
eDamage(pVictim)
{
    static 
pAttackerpAttacker get_user_attacker(pVictim);
    if(!
is_user_connected(pAttacker) || !g_bShowDamage[pAttacker] || !ent_sees_ent(pAttackerpVictim)) return;
    static 
SyncHudMsg; if(!SyncHudMsgSyncHudMsg CreateHudSyncObj();
    
    
set_hudmessage(0100200, -1.00.5520.14.00.020.02, -1);
    
ShowSyncHudMsg(pAttackerSyncHudMsg"%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(!IdMsgIdMsg get_user_msgid("SayText")
    
message_begin(MSG_ONEIdMsg, .player id);
    
write_byte(id);
    
write_string(szMessage);
    
message_end();
}

stock bool:ent_sees_ent(iEntiEnt2)
{
    static 
Float:fEntOrigin[3], Float:fEnt2Origin[3], Float:fResult[3];
    
entity_get_vector(iEntEV_VEC_originfEntOrigin);
    
entity_get_vector(iEnt2EV_VEC_originfEnt2Origin);
    return 
trace_line(iEntfEntOriginfEnt2OriginfResult) == iEnt2;


Last edited by sanimare; 03-10-2018 at 16:39.
sanimare is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 03-10-2018 , 17:25   Re: Bullet Damage [VIP]
Reply With Quote #2

i think you are looking for below plugin with ADMIN_LEVEL_H
Check description of this plugin
https://forums.alliedmods.net/showthread.php?p=1421505
let me know

Last edited by indraraj striker; 03-10-2018 at 17:26.
indraraj striker is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 03-10-2018 , 17:38   Re: Bullet Damage [VIP]
Reply With Quote #3

I tried something like this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define MAX_PLAYERS    32

new g_iMaxPlayers

new bool:g_bShowDamage[33];

new const 
Float:g_flCoords[][] = 
{
    {
0.500.40},
    {
0.560.44},
    {
0.600.50},
    {
0.560.56},
    {
0.500.60},
    {
0.440.56},
    {
0.400.50},
    {
0.440.44}
}

new 
g_iPlayerPos[MAX_PLAYERS+1]

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");

    
g_iMaxPlayers get_maxplayers()

}

public 
client_putinserver(pClient)
{
    new 
sInfo[4]; get_user_info(pClient"_dmg"sInfocharsmax(sInfo));
    if(
sInfo[0] && equal(sInfo"on")) g_bShowDamage[pClient] = true;
    else 
g_bShowDamage[pClient] = false;
}

public 
eDamage(pVictim)
{
    static 
pAttackerpAttacker get_user_attacker(pVictim);
    if((
get_user_flags(pAttacker) & ADMIN_LEVEL_H) || !is_user_connected(pAttacker)) return;
    static 
SyncHudMsg; if(!SyncHudMsgSyncHudMsg CreateHudSyncObj();
        new 
id get_user_attacker(pVictim)
        if( (
<= id <= g_iMaxPlayers) && is_user_connected(id) )
        {
            new 
iPos = ++g_iPlayerPos[id]
            if( 
iPos == sizeof(g_flCoords) )
            {
                
iPos g_iPlayerPos[id] = 0
            
}
    
set_hudmessage(random_num(0224), random_num(0224), random_num(0224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1)
    
ShowSyncHudMsg(pAttackerSyncHudMsg"%i^n"read_data(2));
}
    
}

stock bool:ent_sees_ent(iEntiEnt2)
{
    static 
Float:fEntOrigin[3], Float:fEnt2Origin[3], Float:fResult[3];
    
entity_get_vector(iEntEV_VEC_originfEntOrigin);
    
entity_get_vector(iEnt2EV_VEC_originfEnt2Origin);
    return 
trace_line(iEntfEntOriginfEnt2OriginfResult) == iEnt2;

Not working at all.
I use this plugin so far and it's working, but only what i want is to disable it through walls:
PHP Code:
#include <amxmodx>

#define PLUGIN "Bullet Damage COLORed by Leo_[BH]"
#define AUTHOR "ConnorMcLeod / Leo_[BH]"
#define VERSION "0.0.3"

#define MAX_PLAYERS    32

new const Float:g_flCoords[][] = 
{
    {
0.500.40},
    {
0.560.44},
    {
0.600.50},
    {
0.560.56},
    {
0.500.60},
    {
0.440.56},
    {
0.400.50},
    {
0.440.44}
}

new 
g_iPlayerPos[MAX_PLAYERS+1]

new 
g_iMaxPlayers
new g_pCvarEnabled

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
g_pCvarEnabled register_cvar("bullet_damage""1")

    
register_event("Damage""Event_Damage""b""2>0""3=0")

    
g_iMaxPlayers get_maxplayers()
}

public 
Event_DamageiVictim )
{
    if( 
get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
    {
        new 
id get_user_attacker(iVictim)
        if( (
<= id <= g_iMaxPlayers) && is_user_connected(id) )
        {
            new 
iPos = ++g_iPlayerPos[id]
            if( 
iPos == sizeof(g_flCoords) )
            {
                
iPos g_iPlayerPos[id] = 0
            
}
            
set_hudmessage(random_num(0224), random_num(0224), random_num(0224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1)
            
show_hudmessage(id"%d"read_data(2))
        }
    }

sanimare is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 03-10-2018 , 17:40   Re: Bullet Damage [VIP]
Reply With Quote #4

so the second one is working and you just want me to add disable it through walls and admin_level_h
indraraj striker is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 03-11-2018 , 06:18   Re: Bullet Damage [VIP]
Reply With Quote #5

Quote:
Originally Posted by indraraj striker View Post
so the second one is working and you just want me to add disable it through walls and admin_level_h
That's right. I can add check for level flag, but if you can do it with or without.

In this code i want no bullet damage show through walls, just direct shots.
PHP Code:
public Event_DamageiVictim )
{
    if( 
get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
    {
        new 
id get_user_attacker(iVictim)
        if( (
<= 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(0224), random_num(0224), random_num(0224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1)
            
show_hudmessage(id"%d"read_data(2))
        }
    }


Last edited by sanimare; 03-11-2018 at 06:20.
sanimare is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 03-11-2018 , 06:27   Re: Bullet Damage [VIP]
Reply With Quote #6

Test this

PHP Code:

public Event_DamageiVictim )
{
    if( 
get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
    {
        new 
id get_user_attacker(iVictim)
        if( (
<= id <= g_iMaxPlayers) && is_user_connected(id) )
        if ( (
get_user_flags(id) & ADMIN_LEVEL_H) && ent_sees_ent(idiVictim))
        {
            new 
iPos = ++g_iPlayerPos[id]
            if( 
iPos == sizeof(g_flCoords) )
            {
                
iPos g_iPlayerPos[id] = 0
            
}
            
set_hudmessage(random_num(0224), random_num(0224), random_num(0224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1)
            
show_hudmessage(id"%d"read_data(2))
        }
    }
}  

stock bool:ent_sees_ent(iEntiEnt2)
{
    static 
Float:fEntOrigin[3], Float:fEnt2Origin[3], Float:fResult[3];
    
entity_get_vector(iEntEV_VEC_originfEntOrigin);
    
entity_get_vector(iEnt2EV_VEC_originfEnt2Origin);
    return 
trace_line(iEntfEntOriginfEnt2OriginfResult) == iEnt2;

indraraj striker is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 03-11-2018 , 06:54   Re: Bullet Damage [VIP]
Reply With Quote #7

Testing now, i will edit if all work.

Last edited by sanimare; 03-11-2018 at 06:58.
sanimare is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 03-11-2018 , 07:04   Re: Bullet Damage [VIP]
Reply With Quote #8

Test this one
PHP Code:

public Event_DamageiVictim 

    if( 
get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) ) 
    { 
        new 
id get_user_attacker(iVictim
        if( (
<= id <= g_iMaxPlayers) && is_user_connected(id) && (get_user_flags(id) & ADMIN_LEVEL_H) && ent_sees_ent(idiVictim)) 
     {
            new 
iPos = ++g_iPlayerPos[id
            if( 
iPos == sizeof(g_flCoords) ) 
            { 
                
iPos g_iPlayerPos[id] = 
            

            
set_hudmessage(random_num(0224), random_num(0224), random_num(0224), Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1
            
show_hudmessage(id"%d"read_data(2)) 
        } 
    } 
}   

stock bool:ent_sees_ent(iEntiEnt2

    static 
Float:fEntOrigin[3], Float:fEnt2Origin[3], Float:fResult[3]; 
    
entity_get_vector(iEntEV_VEC_originfEntOrigin); 
    
entity_get_vector(iEnt2EV_VEC_originfEnt2Origin); 
    return 
trace_line(iEntfEntOriginfEnt2OriginfResult) == iEnt2

If this does not work please share full plugin which you are using.
indraraj striker is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 03-11-2018 , 07:44   Re: Bullet Damage [VIP]
Reply With Quote #9

It's working [No damage through walls] but it's buging direct shots, not showing bullet damage around crosshair all the time, it happens i shot enemy and showing just one hit, others no.

Here's other codes:
Code:
//BulletDamage
new const Float:g_flCoords[][] = 
{
	{0.50, 0.40},
	{0.56, 0.44},
	{0.60, 0.50},
	{0.56, 0.56},
	{0.50, 0.60},
	{0.44, 0.56},
	{0.40, 0.50},
	{0.44, 0.44}
}

new g_iPlayerPos[MAX_PLAYERS+1]
//BulletDamage
Code:
	//register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
	register_event("Damage", "Event_Damage", "b", "2>0", "3=0")

Last edited by sanimare; 03-11-2018 at 08:30.
sanimare 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:22.


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