Here is a more further detailed example based from connorrs example:
PHP Code:
public fwEmitSound(id, channel, const sound[], Float:volume, Float:attenuation, flags, pitch)
{
// Check to see if user is connected and a zombie (using isZombie for example)
if(!is_user_connected(id) || !isZombie[id])
return FMRES_IGNORED;
if(containi(sound, "die") != -1 || containi(sound, "death") != -1)
{
// Here it will play your sound and block the old death sound
engfunc(EngFunc_EmitSound, id, channel, "zombie/zombie_die3.wav", 1.0, attenuation, flags, pitch);
// Below I made it so it would play a random death sound when they died, just for an example
/*
new randNum = random_num(1, 4);
switch(randNum)
{
case 1: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_1, 0.7, attenuation, flags, pitch);
case 2: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_2, 0.7, attenuation, flags, pitch);
case 3: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_3, 0.7, attenuation, flags, pitch);
case 4: engfunc(EngFunc_EmitSound, id, channel, ZOMBIE_DEATH_4, 0.7, attenuation, flags, pitch);
}
*/
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}