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

Damage Glow v1.4


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-17-2009 , 21:58   Re: Damage Glow v1.2
Reply With Quote #11

Hi.

Some suggestions :

- Please, fix your indentation. Either use tabs either spaces, but not both at the same time. The result is a quite a mess now. ^^
- Try to rename 'pcvar', it doesn't hurt to write a name more descriptive.
- Try to keep always {}

As idea, if interested, here a plugin I'm using since a long time ago, I've just fastly optimized the original plugin. ( I think it was an Amx plugin ). It may give you some idea. You will get progressively green to red color depending the damage.

PHP Code:
    
    
#include <amxmodx>
    #include <fakemeta>
    #include <hamsandwich>
    
    
const MAX_PLAYERS 32;

    new 
Float:gMaxHealth MAX_PLAYERS ];
    new 
bool:gIsConnectedMAX_PLAYERS ];

    public 
plugin_init()
    {
        
register_plugin"Glow When Damaged""1.0""A1win" );

        
RegisterHamHam_Spawn"player""Event_PlayerSpawn");
        
register_event"Damage""Event_PlayerTakeDamage""b""2!0""3=0""4!0" );
    }
    
    public 
client_putinserverClient )
    {
        
gIsConnectedClient ] = true;
    }
    
    public 
client_disconnectClient )
    {   
        
gIsConnectedClient ] = false;
    }

    public 
Event_PlayerSpawn( const Client 
    {
        if ( 
is_user_aliveClient ) )
        {
            
pevClientpev_healthgMaxHealthClient ] );
            
remove_taskClient ); 
            
RemoveGlow Client );
        }
    }

    public 
Event_PlayerTakeDamage( const Client )
    {
        if ( 
gIsConnectedClient ] )
        {
            static 
Float:RenderColor];
            static 
Float:CurrHealth;
            static 
Float:r;
            static 
Float:g;
            static 
Float:Hl;
            
            
pevClientpev_healthCurrHealth );
            
Hl gMaxHealthClient ] * 0.5;
            
            if( 
CurrHealth == Hl )
            {
                
255.0;
                
255.0;
            }
            else if( 
CurrHealth Hl )
            {
                
255.0;
                
5.1 CurrHealth;
            }
            else if( 
CurrHealth Hl && CurrHealth != gMaxHealthClient ] )
            {
                
255.0 5.1 * ( CurrHealth 50 );
                
255.0;
            }
            
            
RenderColor] = r;
            
RenderColor] = g;
            
            
UTIL_SetRenderingClientkRenderFxGlowShellRenderColorkRenderNormal10.0 );
            
            
remove_taskClient );
            
set_task1.0"RemoveGlow"Client );
        }

    }

    public 
RemoveGlow ( const Client )
    {
        if( 
gIsConnectedClient ] )
        {    
            
UTIL_SetRendering ClientkRenderFxNoneFloat:{ 0.00.00.0 }, kRenderNormal0.0 );
        }
    }
    
    
UTIL_SetRendering ( const Client, const RenderFx, const Float:RenderColor], const Render, const Float:Amount )
    {
        
set_pevClientpev_renderfx   RenderFx );
        
set_pevClientpev_rendercolorRenderColor );
        
set_pevClientpev_rendermode Render );
        
set_pevClientpev_renderamt  Amount );
    } 
Arkshine is offline
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 03-18-2009 , 15:50   Re: Damage Glow v1.3
Reply With Quote #12

updated v1.3 thanks
__________________
Find my plugins here..

Ex - Spanish Moderator.
Starsailor is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 03-18-2009 , 17:52   Re: Damage Glow v1.3
Reply With Quote #13

Maybe a cvar to switch between glowing in team colors or based on health would be better. You forgot to ident SetRendering properly ;)
__________________
In Flames we trust!
Nextra is offline
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 03-18-2009 , 18:49   Re: Damage Glow v1.3
Reply With Quote #14

Quote:
Originally Posted by Nextra View Post
Maybe a cvar to switch between glowing in team colors or based on health would be better. You forgot to ident SetRendering properly ;)

updated, thanks
__________________
Find my plugins here..

Ex - Spanish Moderator.
Starsailor is offline
eXoDiA
Junior Member
Join Date: Mar 2009
Old 03-19-2009 , 09:39   Re: Damage Glow v1.4
Reply With Quote #15

GJ Starsailor
__________________

eXoDiA is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-22-2009 , 15:14   Re: Damage Glow v1.4
Reply With Quote #16

As feature, you can add that only player which do damage will see the glow. Just looking this plugin http://forums.alliedmods.net/showthread.php?t=87845 ; It would be interesting.
Arkshine is offline
Old 03-22-2009, 19:29
Starsailor
This message has been deleted by Starsailor. Reason: under
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 03-22-2009 , 20:44   Re: Damage Glow v1.4
Reply With Quote #17

mm i dont know

the idea of plugin is that everyone knows who is being attacked
__________________
Find my plugins here..

Ex - Spanish Moderator.
Starsailor is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-22-2009 , 21:27   Re: Damage Glow v1.4
Reply With Quote #18

Ah yeah. Well it was just an idea. But you're right.
Arkshine is offline
letgoofmyeggs
Senior Member
Join Date: Aug 2006
Old 03-30-2009 , 01:14   Re: Damage Glow v1.4
Reply With Quote #19

hey, im running this plugin with another plugin that makes everyone always glow their team color from this thread.
http://forums.alliedmods.net/showthread.php?t=74052

there is a little bug. when damage is dealt, the person stops glowing their team color. i was wondering if it would be possible to make it so both plugins function properly.
letgoofmyeggs is offline
Starsailor
horrible hahah
Join Date: Aug 2008
Location: Buenos Aires
Old 03-30-2009 , 19:42   Re: Damage Glow v1.4
Reply With Quote #20

i recommend you use this plugin for this

http://forums.alliedmods.net/showthread.php?p=728858
__________________
Find my plugins here..

Ex - Spanish Moderator.

Last edited by Starsailor; 03-30-2009 at 20:41.
Starsailor 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 15:57.


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