With spk only the player hear the sound, with emit_sound the sound emits in the position of the player:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#define PLUGIN "Zombie Pain Sounds"
#define VERSION "1.0"
#define AUTHOR "MiZi"
// Zombie Attributes
new const zclass_name[] = { "Zombie" }
new const zclass_info[] = { "Super schopnosti" }
new const zclass_model[] = { "zombie_source" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 6000
const zclass_speed = 300
const Float:zclass_gravity = 0.8
const Float:zclass_knockback = 1.0
/**Sounds**/
new const PAIN_SOUND[] = "infection_6.wav"
new const DEATH_SOUND[] = "zombie_die1.wav"
/*============================================ ================================*/
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("Damage", "emit_painsound", "b", "2!0", "3=0", "4!0")
register_event("DeathMsg","emit_deathsound","a")
}
public plugin_precache()
{
// Register class
zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
engfunc(EngFunc_PrecacheSound, PAIN_SOUND)
engfunc(EngFunc_PrecacheSound, DEATH_SOUND)
}
public emit_painsound(id)
emit_sound(id, CHAN_AUTO, PAIN_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM)
public emit_deathsound(id)
{
new victim = read_data(2)
emit_sound(victim, CHAN_AUTO, DEATH_SOUND, 1.0, ATTN_NORM, 0, PITCH_NORM)
}