Raised This Month: $51 Target: $400
 12% 

[HELP] with change bullet damage color


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 11-01-2016 , 07:11   [HELP] with change bullet damage color
Reply With Quote #1

Hello everyone. well i use the plugin of bboygrun show damage to zombie plague work fine but i want when the player make a damage of 1000hp the hud of acumulate change to yellow color and when the player make a damage of 4000hp the acumulate hud change to red and if is possible with cvars.. thx in advance

so in this order:

0-1000 - green
1000 - 4000 - bule
4000 - rest of damage - yellow

PHP Code:
             // MyCurrentDamages[ Attacker ] == -1 : The player is a BOT
            
return;
        }
        
        
MyCurrentDamagesAttacker ] += damage
        UpdateDamages
Attacker )
    }
    else
    {
        
// http://forums.alliedmods.net/showthread.php?t=62224
        
static iColoriColor get_pcvar_numpCvar_OurselfC )
        
iColor 1000000
        iColor 
%= 1000000
        G 
iColor 1000
        B 
iColor 1000
        
        set_dhudmessage
RGB, -1.0, -1.020.02.00.10.1 )
        
show_dhudmessageVictim"%i"damage )    // Show the damages to the player
    
}

Full code:
PHP Code:
#include < amxmodx >
#include < engine >

#define VERSION "2.0"

#define DIRECTOR_HUD_MESSAGE    0
#define NORMAL_HUD_MESSAGE    1


new pCvar_VictimCpCvar_OurselfCpCvar_AttackerCpCvar_BulletModepCvar_Bullet_DistancepCvar_Bullet_Walls
pCvar_Bullet_ShowSpecpCvar_Bullet_Hs_ModepCvar_Bullet_Text_ModepCvar_Bullet_Show_ModepCvar_Accumulated_Damage

new dhud_colordhud_xdhud_ydhud_effectdhud_fxtimedhud_holdtimedhud_fadeintimedhud_fadeouttimedhud_reliable

new FloatYv33 ], FloatXv33 /* Victim*/FloatYa33 ], FloatXa33 // Attacker

new boolShowMeThisHud33 ], MyCurrentDamages33 ], iSyncObj

public plugin_init( ) 
{
    
register_plugin"Bullet Damage"VERSION"Bboy Grun" )
    
    
register_cvar"Director_bullet_dmg"VERSIONFCVAR_SERVER FCVAR_SPONLY )
    
set_cvar_string"Director_bullet_dmg"VERSION )
    
    
register_event"Damage""Event_Damage""b""2!0""3=0""4!0" 
    
    
register_clcmd"say /showbd""Say_showbd" )
    
register_clcmd"say showbd""Say_showbd" )
    
    
iSyncObj CreateHudSyncObj( )
    
    
pCvar_BulletMode =             register_cvar"Bullet_Damage_Mode""0" 
    
pCvar_Bullet_Distance =        register_cvar"Bullet_Damage_Distance""600" 
    
pCvar_Bullet_Walls =         register_cvar"Bullet_Damage_NoShowWalls""0" )
    
pCvar_Bullet_ShowSpec =        register_cvar"Bullet_Show_Spec""1" )
    
pCvar_Bullet_Hs_Mode  =         register_cvar"Bullet_Hs_Mode""2" )
    
pCvar_Bullet_Text_Mode =    register_cvar"Bullet_Text_Mode""0" )
    
pCvar_Bullet_Show_Mode =     register_cvar"Bullet_Show_Mode""3" )
    
pCvar_Accumulated_Damage =     register_cvar"Show_Accumulated_Damage""1" )
    
    
pCvar_VictimC =         register_cvar"Color_RGB_Victim""255000000" )
    
pCvar_AttackerC =         register_cvar"Color_RGB_Attacker""000255000" )
    
pCvar_OurselfC =        register_cvar"Color_RGB_Ourself_Teammate""255102021" )
}

public 
plugin_natives( )
{
    
register_native"bd_show_damage""native_bd_show_damage")
    
register_native"bd_show_text""native_bd_show_text")
}

// HELP : http://forums.alliedmods.net/showthread.php?p=1436434#post1436434 Thanks to schmurgel1983
public native_bd_show_textiPluginiParams )
{
    new 
id get_param)
    
    if( !
is_user_connectedid ) ) // user disconnected .. return 0
    
{
        return 
0
    
}
    
    new 
Text128 ], AttackerSize
    
    Attacker 
get_param)
    
Size get_param)
    
    
get_string3TextcharsmaxText ) )
    
show_client_textidTextAttackerSize )
    
    if( 
Attacker // Is the player attacker ? Yes = 1 -- No = 0
    
{
        
CheckPositionidAttacker )
        return 
1
    
}
    
    
CheckPositionid)
    return 
1
}

public 
native_bd_show_damageiPluginiParams )
{
    new 
id get_param)
    
    if( !
is_user_connectedid ) )
    {
        return 
0
    
}
    
    new 
damagestyleAttacker
    damage 
get_param); style get_param); Attacker get_param)
    
    
show_client_valueiddamageAttackerstyle )
    
    if( 
Attacker // Is the player attacker ? Yes = 1 -- No = 0
    
{
        
CheckPositionidAttacker )
        return 
1
    
}
    
    
CheckPositionid)
    return 
1
}

// Director Hud Message, go to : http://forums.alliedmods.net/showthread.php?t=149210 by : ARKSHINE
public Event_DamageVictim )
{    
    static 
AttackerAttackerWpnVictimBodyPart
    Attacker 
get_user_attackerVictimAttackerWpnVictimBodyPart )
    
    if( !
is_user_aliveAttacker ) || ( get_pcvar_numpCvar_Bullet_Walls ) && !is_visibleAttackerVictim ) ) )
    {
        return;
    }
        
    static 
damageRGBpCvar_HpCvar_TMODE 
    damage 
read_data)
    
    
pCvar_H get_pcvar_numpCvar_Bullet_Hs_Mode )
    
pCvar_TMODE get_pcvar_numpCvar_Bullet_Text_Mode )
    
    static 
AttackerOrigin], VictimOrigin]
    
    if( 
Attacker != Victim && get_user_teamAttacker ) != get_user_teamVictim ) )
    {
        if( 
pCvar_H && VictimBodyPart == HIT_HEAD )
        {
            if( 
pCvar_H == )
            {
                
show_client_valueVictimdamage0DIRECTOR_HUD_MESSAGE )
                
show_client_valueAttackerdamage1DIRECTOR_HUD_MESSAGE )
            }
            else
            {
                
show_client_textVictim"HEADSHOT"0pCvar_TMODE )
                
show_client_textAttacker"HEADSHOT"1pCvar_TMODE )
            }
        }
        else
        {
            if( !
get_pcvar_numpCvar_BulletMode ) )
            {
                
show_client_valueVictimdamage0DIRECTOR_HUD_MESSAGE )
                
show_client_valueAttackerdamage1DIRECTOR_HUD_MESSAGE )
            }
        
            else
            {
                
get_user_originAttackerAttackerOrigin )
                
get_user_originVictimVictimOrigin )
                
                if( 
get_distanceAttackerOriginVictimOrigin ) >  get_pcvar_numpCvar_Bullet_Distance ) )
                {
                    
show_client_valueVictimdamage0NORMAL_HUD_MESSAGE )
                    
show_client_valueAttackerdamage1NORMAL_HUD_MESSAGE )
                }
                else
                {
                    
show_client_valueVictimdamage0DIRECTOR_HUD_MESSAGE )
                    
show_client_valueAttackerdamage1DIRECTOR_HUD_MESSAGE )
                }
            }
        }
        
        
CheckPositionVictim)
        
CheckPositionAttacker)
        
        if( 
MyCurrentDamagesAttacker ] == -|| !get_pcvar_numpCvar_Accumulated_Damage ) )
        {
             
// MyCurrentDamages[ Attacker ] == -1 : The player is a BOT
            
return;
        }
        
        
MyCurrentDamagesAttacker ] += damage
        UpdateDamages
Attacker )
    }
    else
    {
        
// http://forums.alliedmods.net/showthread.php?t=62224
        
static iColoriColor get_pcvar_numpCvar_OurselfC )
        
iColor 1000000
        iColor 
%= 1000000
        G 
iColor 1000
        B 
iColor 1000
        
        set_dhudmessage
RGB, -1.0, -1.020.02.00.10.1 )
        
show_dhudmessageVictim"%i"damage )    // Show the damages to the player
    
}
}

public 
Say_showbdid 
{
    if( 
ShowMeThisHudid ] )
    {
        
ShowMeThisHudid ] = false
        client_print
idprint_chat"[ BULLET DAMAGE %s ] STATUS : OFF"VERSION )
        return;
    }
    
    
client_printidprint_chat"[ BULLET DAMAGE %s ] STATUS : ON"VERSION )
    
ShowMeThisHudid ] = true
}

public 
client_putinserverid )
{
    
iRefreshHudPositionid )
    
    
ShowMeThisHudid ] = true
    MyCurrentDamages
id ] = is_user_botid ) ? -0
    
    
// Don't show Current Accumulated Damages to bots
}

// Director Hud Message, go to : http://forums.alliedmods.net/showthread.php?t=149210 by : ARKSHINE

stock set_dhudmessagered 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 6.0Float:holdtime 3.0Float:fadeintime 0.1Float:fadeouttime 1.5bool:reliable false )
{
    
#define clamp_byte(%1)               ( clamp( %1, 0, 255 ) )
    #define pack_color(%1,%2,%3)    ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )

    
dhud_color        =         pack_colorclamp_bytered ), clamp_bytegreen ), clamp_byteblue ) )
    
dhud_x             =    _:    x
    dhud_y             
=     _:     y
    dhud_effect         
=         effects
    dhud_fxtime         
=     _:     fxtime
    dhud_holdtime         
=    _:     holdtime
    dhud_fadeintime     
=    _:     fadeintime
    dhud_fadeouttime     
=    _:     fadeouttime
    dhud_reliable         
=     _:     reliable

    
return 1;
}

stock show_dhudmessageindex, const message[ ], any:... )
{
    new 
buffer128 ]
    new 
numArguments numargs( )

    if( 
numArguments == )
    {
        
send_dhudMessageindexmessage )
    }
    else if( 
index || numArguments == )
    {
        
vformatbuffercharsmaxbuffer ), message)
        
send_dhudMessageindexbuffer )
    }
    else
    {
        new 
playersList32 ], numPlayers;
        
get_playersplayersListnumPlayers"ch" )

        if( !
numPlayers )
        {
            return 
0;
        }

        new Array:
handleArrayML ArrayCreate()

        for( new 
2jnumArgumentsi++ )
        {
            if( 
getarg) == LANG_PLAYER )
            {
                while( ( 
buffer] = getarg1j++ ) ) ) {}
                
0

                
if( GetLangTransKeybuffer ) != TransKey_Bad )
                {
                    
ArrayPushCellhandleArrayMLi++ )
                }
            }
        }

        new 
size ArraySizehandleArrayML )

        if( !
size )
        {
            
vformatbuffercharsmaxbuffer ), message)
            
send_dhudMessageindexbuffer )
        }
        else
        {
            for( new 
0jnumPlayersi++ )
            {
                
index playersList]

                for( 
0sizej++ )
                {
                    
setargArrayGetCellhandleArrayML), 0index )
                }
                
                
vformatbuffercharsmaxbuffer ), message)
                
send_dhudMessageindexbuffer )
            }
        }

        
ArrayDestroyhandleArrayML )
    }
    return 
1;
}

stock send_dhudMessage( const index, const message[ ] )
{
    
message_begindhud_reliable ? ( index MSG_ONE MSG_ALL ) : ( index MSG_ONE_UNRELIABLE MSG_BROADCAST ), SVC_DIRECTOR_index )
    {
        
write_bytestrlenmessage ) + 31 )
        
write_byteDRC_CMD_MESSAGE )
        
write_bytedhud_effect )
        
write_longdhud_color )
        
write_longdhud_x )
        
write_longdhud_y )
        
write_longdhud_fadeintime )
        
write_longdhud_fadeouttime )
        
write_longdhud_holdtime )
        
write_longdhud_fxtime )
        
write_stringmessage )
    }
    
message_end()


UpdateDamagesid )
{
    if( !
ShowMeThisHudid ] )
    {
        return;
    }
    
    
set_hudmessage02550, -1.0, -0.5000.04.00.01.0, -)
    
ShowSyncHudMsgidiSyncObj"%d"MyCurrentDamagesid ] )
    
    if( 
task_exists999_666_999 id ) )
    {
        
remove_task999_666_999 id 
    }
    
    
set_task5.0"ResetCurrentDamages"999_666_999 id )
}

public 
ResetCurrentDamagesTaskID )
{
    
MyCurrentDamagesTaskID 999_666_999 ] = 0
}

show_client_valueiddamageAttackeriSize )
{
    if( !
ShowMeThisHudid ] )
    {
        return;
    }
    
    static 
iColorRGBFloatY_PosFloatX_Pos
    
    
if( Attacker // The user is the Attacker ( Attacker value = 1 )
    
{
        
// Attacker
        
iColor get_pcvar_numpCvar_AttackerC )
        
Y_Pos Yaid ]
        
X_Pos Xaid ]
    }
    else
    {
        
// Victim
        
iColor get_pcvar_numpCvar_VictimC )
        
Y_Pos Yvid ]
        
X_Pos Xvid ]
    }
    
    
iColor 1000000
    iColor 
%= 1000000
    G 
iColor 1000
    B 
iColor 1000
    
    
if( iSize )
    {
        
set_hudmessageRGBX_PosY_Pos20.01.00.020.02 )
        
show_hudmessageid"%i"damage )
    }
    else
    {
        
set_dhudmessageRGBX_PosY_Pos20.01.00.020.02 )
        
show_dhudmessageid"%i"damage )
    }
    
    if( !
get_pcvar_numpCvar_Bullet_ShowSpec ) )
    {
        return;
    }
    
    
SpectatorHudiddamage_0iSizeFloatX_PosFloatY_PosRG)
}

show_client_textidiText[ ], AttackeriSize )
{
    if( !
ShowMeThisHudid ] )
    {
        return;
    }
    
    static 
iColorRGBFloatY_PosFloatX_Pos
    
    
if( Attacker // The user is the Attacker ( Attacker value = 1 )
    
{
        
// Attacker
        
iColor get_pcvar_numpCvar_AttackerC )
        
Y_Pos Yaid ]
        
X_Pos Xaid ]
    }
    else
    {
        
// Victim
        
iColor get_pcvar_numpCvar_VictimC )
        
Y_Pos Yvid ]
        
X_Pos Xvid ]
    }
    
    
iColor 1000000
    iColor 
%= 1000000
    G 
iColor 1000
    B 
iColor 1000
    
    
if( !iSize )
    {
        
set_dhudmessageRGBX_PosY_Pos20.01.00.020.02 )
        
show_dhudmessageid"%s"iText )
    }
    else
    {
        
set_hudmessageRGBX_PosY_Pos20.01.00.020.02, -)
        
show_hudmessageid"%s"iText )
    }
    
    if( !
get_pcvar_numpCvar_Bullet_ShowSpec ) )
    {
        return;
    }
    
    
SpectatorHudid_iText1iSizeFloatX_PosFloatY_PosRG)
}

SpectatorHudidiDamage 0iText[ ] = ""TextModeSizeFloatX_PosFloatY_PosRG)
{
    static 
iPlayers32 ], iNum
    get_players
iPlayersiNum"bch" )
    
    for( new 
0Spectator iPlayers]; iNumSpectator iPlayersi++ ] )
    {        
        if( 
ShowMeThisHudSpectator ] && entity_get_intSpectatorEV_INT_iuser2 ) == id )
        {
            if( !
Size )
            {
                
set_dhudmessageRGBX_PosY_Pos20.01.00.020.02 )
                
TextMode show_dhudmessageSpectator"%s"iText ) : show_dhudmessageSpectator"%d"iDamage )
            }
            else
            {
                
set_hudmessageRGBX_PosY_Pos20.01.00.020.02, -)
                
TextMode show_hudmessageSpectator"%s"iText ) : show_hudmessageSpectator"%d"iDamage )
            }
        }
    }
}

iRefreshHudPositionid )
{
    switch( 
get_pcvar_numpCvar_Bullet_Show_Mode ) )
    {
        case 
0:
        {
            
Yaid ] = -0.50
            Xa
id ] = -0.70
            
            Yv
id ] = -0.45
            Xv
id ] = -0.30
            
        
}
        case 
1:
        {
            
Yaid ] = 0.55
            Xa
id ] = 0.53
            
            Xv
id ] = 0.45
            Yv
id ] = 0.50
        
}
        case 
2:
        {
            
Yaid ] = -0.35
            Xa
id ] = -0.70
            
            Yv
id ] = -0.20
            Xv
id ] = -0.70
        
}
        case 
3:
        {
            
Xvid ] = -0.80
            Yv
id ] = -0.90
            
            Xa
id ] = -0.20
            Ya
id ] = -0.90
        
}
    }
}

CheckPositionidAttacker )
{
    switch( 
get_pcvar_numpCvar_Bullet_Show_Mode ) ) 
    
// [ 0 = CIRCLE ] [ 1 = VERTICAL ] [ 2 = HORIZONTAL ] [ 3 = ARCH OF CIRCLE  ]
    
{
        case 
0:
        {
            if( 
Attacker )
            {
                switch( 
Xaid ] )
                {
                    case -
0.70// First attack
                    
{
                        
Xaid ] = -0.575
                        Ya
id ] = -0.60
                    
}
                    case -
0.575// Second
                    
{
                        
Xaid ] = -0.50
                        Ya
id ] = -0.625
                    
}
                    case -
0.50// Third
                    
{
                        
Xaid ] = -0.425
                        Ya
id ] = -0.60
                    
}
                    case -
0.425// Fourth
                    
{        
                        
Xaid ] = -0.30
                        Ya
id ] = -0.50
                    
}
                    case -
0.30// Last
                    
{
                        
Xaid ] = -0.70
                    
}
                    default: 
iRefreshHudPositionid )
                }
            }
            else
            {
                switch( 
Xvid ] )
                {
                    case -
0.30// First attack
                    
{
                        
Xvid ] = -0.425
                        Yv
id ] = -0.35
                    
}
                    case -
0.425// Second
                    
{        
                        
Xvid ] = -0.50
                        Yv
id ] = -0.30
                    
}
                    case -
0.50// Third
                    
{
                        
Xvid ] = -0.575
                        Yv
id ] = -0.35
                    
}
                    case -
0.575// fourth
                    
{
                        
Xvid ] = -0.70
                        Yv
id ] = -0.45
                    
}
                    case -
0.70// Last
                    
{
                        
Xvid ] = -0.30
                    
}
                    default: 
iRefreshHudPositionid )
                }
            }
        }
        case 
1:
        {
            if( 
Attacker 
            {
                
Yaid ] += 0.05
                
if( Yaid ] >= 0.90 )
                {
                    
Yaid ] = 0.55
                
}
            }
            else
            {
                
Yvid ] += 0.05
                
if( Yvid ] >= 0.85 )
                {
                    
Yvid ] = 0.50
                
}
            }
        }
        case 
2:
        {
            if( 
Attacker )
            {
                
Xaid ] += 0.05
                
if( Xaid ] >= -0.35 )
                {
                    
Xaid ] = -0.70
                
}
            }
            else
            {
                
Xaid ] += 0.05
                
if( Xvid ] >= -0.35 )
                {
                    
Xvid ] = -0.70
                
}
            }
        }
        case 
3:
        {
            if( 
Attacker )
            {
                switch( 
Xaid ] )
                {
                    case -
0.20// First attack
                    
{
                        
                        if( 
Yaid ] == -0.20 )
                        {
                            
Xaid ] = -0.20
                            Ya
id ] = -0.90
                        
}
                        else
                        {
                            
Xaid ] = -0.15
                            Ya
id ] = -0.80
                        
}
                    }
                    case -
0.15:
                    {
                        switch( 
Yaid ] )
                        {
                            case -
0.80Yaid ] = -0.70
                            
case -0.70Yaid ] = -0.60
                            
case -0.60Yaid ] = -0.50
                            
case -0.50Yaid ] = -0.40
                            
case -0.40Yaid ] = -0.30
                            
case -0.30:
                            {
                                
Xaid ] = -0.20
                                Ya
id ] = -0.20
                            
}
                        }
                    }
                    default: 
iRefreshHudPositionid )
                }
            }
            else
            {
                switch( 
Xvid ] )
                {
                    case -
0.80// First attack
                    
{
                        
                        if( 
Yvid ] == -0.20 )
                        {
                            
Xvid ] = -0.80
                            Yv
id ] = -0.90
                        
}
                        else
                        {
                            
Xvid ] = -0.85
                            Yv
id ] = -0.80
                        
}
                    }
                    case -
0.85:
                    {
                        switch( 
Yvid ] )
                        {
                            case -
0.80Yvid ] = -0.70
                            
case -0.70Yvid ] = -0.60
                            
case -0.60Yvid ] = -0.50
                            
case -0.50Yvid ] = -0.40
                            
case -0.40Yvid ] = -0.30
                            
case -0.30:
                            {
                                
Xvid ] = -0.80
                                Yv
id ] = -0.20
                            
}
                        }
                    }
                    default: 
iRefreshHudPositionid )
                }
            }
        }
        default: 
iRefreshHudPositionid )
    }

__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015

Last edited by XMaDNeSS; 11-01-2016 at 07:12.
XMaDNeSS is offline
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 11-02-2016 , 12:32   Re: [HELP] with change bullet damage color
Reply With Quote #2

#Any help please!
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS is offline
XMaDNeSS
Member
Join Date: Oct 2016
Location: Palestine, Nablus.
Old 11-03-2016 , 17:12   Re: [HELP] with change bullet damage color
Reply With Quote #3

UP ! pleeeeeeeeeeeeease
__________________
http://zombieonzone.com ForEver
Free Palestine.
[ZoZ].:Zombie Plague:.1000FPS FastDL NonSteam
91.134.234.190:27015
XMaDNeSS 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 09:20.


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