Thread: [Subplugin Submission] [ZP] Extra Item: Gas Mask
View Single Post
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 07-11-2012 , 23:30   Re: [ZP] Extra Item: Gas Mask
Reply With Quote #55

Quote:
Originally Posted by H.RED.ZONE View Post

Last thing i didn't want to update just that simple edit so i added my chat in the plugin..
I still need to use "client_PreThink" because of the icon if you have any other suggestion post...
I made mistake? Tell me ill fix it .
PS: I didn't tested it don't know if it works.
To display this icon, you need only the player id, and you have it in fw_ThinkGrenade ( with your loop ). So you can remove clientPrethink.

You made one mistake too, if you return a value in the loop, you will forget some players.

And I don't understand why you need to know if the owner is alive.

I think something like that ( untested ) :

PHP Code:
public fw_ThinkGrenadeentity 
{
    if( 
is_valid_ententity ) && zp_get_user_zombie entity_get_edictentityEV_ENT_owner ))) // zombie grenade ?
    
{
        new 
_cvar_range get_pcvar_num_pcvar_range // Maybe cache this cvar in the beginning of the round ? It will be better
        
new _cvar_after_icon_on get_pcvar_num_pcvar_after_icon_on )
        new 
_cvar_after_remove get_pcvar_num_pcvar_after_remove )
        new 
_cvar_icon_status get_pcvar_num_pcvar_icon_status )
        
        for( new 
id id <= g_MaxPlayers id++ ) 
        {
            if( 
_IsPlayerAliveid ) && _IsPlayerInMaskid ))
            {
                if( 
_cvar_after_icon_on == 1
                {
                    
message_beginMSG_ONE_UNRELIABLEg_icon, { 00}, id );
                    
write_byte_cvar_icon_status );
                    
write_string"dmg_gas" );
                    
write_byte);
                    
write_byte255 );
                    
write_byte);
                    
message_end( );
                }    
                
                if( 
get_entity_distanceentityid ) <= _cvar_range )
                {
                    
remove_entityentity )
                    
                    if( 
_cvar_after_remove )
                    {
                        
_ClearPlayerInMaskid )
                        
ProtoChat(id"Infect nade is removed, you don't have mask anymore.")
                    }
                }
            }
        }
    }
    
    return 
HAM_IGNORED;

__________________
micapat is offline