I would do it at EmitSound since you can block it here easily.
You need to check two conditions for this:
- Check if the player who is emitting the sound is dead because it is the only sound a dead player will ever make.
- Check to see if the killers weapon is one of the blocked weapons and if so block the sound.
This will block death sound if killed by usp or glock. This will only work with guns/knife and not grenades, but can be modified to support grenades.
PHP Code:
#include <amxmodx>
#include <fakemeta>
new const Version[] = "0.1";
#define MAX_PLAYERS 32
#define IsPlayer(%1) (1<=%1<=MAX_PLAYERS)
const g_IgnoreGuns = ( 1 << CSW_USP | 1 << CSW_GLOCK18 );
new g_Killer[ MAX_PLAYERS + 1 ];
public plugin_init()
{
register_plugin( "Block Death Sound" , Version , "bugsy" );
register_forward( FM_EmitSound , "EmitSound" );
register_event( "DeathMsg" , "DeathMsg" , "a" , "1>0" );
}
public EmitSound( iEntity , iChannel , const szSample[] , Float:fVolume , Float:fAtten , Flags , Pitch )
{
return ( IsPlayer( iEntity ) && !is_user_alive( iEntity ) && ( g_IgnoreGuns & ( 1 << get_user_weapon( g_Killer[ iEntity ] ) ) ) ) ? FMRES_SUPERCEDE : FMRES_IGNORED;
}
public DeathMsg()
{
g_Killer[ read_data( 2 ) ] = read_data( 1 );
}
__________________