Quote:
Originally Posted by H.RED.ZONE
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_ThinkGrenade( entity )
{
if( is_valid_ent( entity ) && zp_get_user_zombie ( entity_get_edict( entity, EV_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 = 1 ; id <= g_MaxPlayers ; id++ )
{
if( _IsPlayerAlive( id ) && _IsPlayerInMask( id ))
{
if( _cvar_after_icon_on == 1)
{
message_begin( MSG_ONE_UNRELIABLE, g_icon, { 0, 0, 0 }, id );
write_byte( _cvar_icon_status );
write_string( "dmg_gas" );
write_byte( 0 );
write_byte( 255 );
write_byte( 0 );
message_end( );
}
if( get_entity_distance( entity, id ) <= _cvar_range )
{
remove_entity( entity )
if( _cvar_after_remove )
{
_ClearPlayerInMask( id )
ProtoChat(id, "Infect nade is removed, you don't have mask anymore.")
}
}
}
}
}
return HAM_IGNORED;
}
__________________