For Counter-Strike I think this should work. You will have to select the sounds you want.
PHP Code:
#include amxmodx
#include fakemeta
#include cstrike
new const Float: IntervalBetweenSounds = 0.85;
new const g_PlayerHurtSounds[ ][ ] = {
"player/bhit_flesh-1.wav", // health
"player/bhit_flesh-2.wav", // health
"player/bhit_flesh-3.wav", // health
"player/bhit_helmet-1.wav", // armor
"player/bhit_kevlar-1.wav", // armor
"player/headshot1.wav", // headshot
"player/headshot2.wav", // headshot
"player/headshot3.wav", // headshot
"player/pl_die1.wav", // < something like "ah" >
"player/pl_fallpain1.wav", // fall pain
"player/pl_fallpain2.wav", // fall pain
"player/pl_fallpain3.wav", // fall pain
"player/pl_pain2.wav", // pain
"player/pl_pain4.wav", // pain
"player/pl_pain5.wav", // pain
"player/pl_pain6.wav", // pain
"player/pl_pain7.wav", // pain
"player/pl_shot1.wav" // < something like "uh" >
};
new const g_Replacements[ ][ ] = {
"misc/talk.wav" // bip
};
new Float: g_Time = 0.0;
bool: IsPlayerHurtSound( Sound[ ] ) {
static Iterator;
for( Iterator = 0; Iterator < sizeof g_PlayerHurtSounds; Iterator ++ )
if( equali( Sound, g_PlayerHurtSounds[ Iterator ] ) )
return true;
return false;
}
public plugin_init( )
register_forward( FM_EmitSound, "EmitSound" );
public plugin_precache( ) {
static Iterator;
for( Iterator = 0; Iterator < sizeof g_Replacements; Iterator ++ )
precache_sound( g_Replacements[ Iterator ] );
}
public EmitSound( Entity, Channel, Sound[ ], Float: Volume, Float: Attenuation, Flags, Pitch ) {
static MaximumClients;
if( !MaximumClients )
MaximumClients = get_maxplayers( );
if( 1 <= Entity <= MaximumClients ) {
static Model[ 32 ], bool: IsHurtSound, bool: IsSas;
cs_get_user_model( Entity, Model, sizeof Model - 1 );
IsHurtSound = IsPlayerHurtSound( Sound );
IsSas = bool: equali( Model, "sas" );
if( IsHurtSound ) {
if( IsSas ) {
if( get_gametime( ) - g_Time > IntervalBetweenSounds ) {
emit_sound( Entity, Channel, g_Replacements[ random_num( 0, sizeof g_Replacements - 1 ) ], VOL_NORM, 0.92, Flags, Pitch );
g_Time = get_gametime( );
return FMRES_SUPERCEDE;
}
else
return FMRES_SUPERCEDE;
}
}
}
return FMRES_IGNORED;
}
__________________