#include <amxmodx>
#include <fakemeta>
#define MAX_HOSTAGES 4
#define MAX_PHRASES 5
new g_phrases[MAX_HOSTAGES][MAX_PHRASES][] = {
{"barney/ba_dontmake.wav", "barney/ba_later.wav", "barney/diebloodsucker.wav", "barney/somethingstinky.wav", "barney/bequiet.wav"},
{"hgrunt/go!.wav", "hgrunt/hostiles!.wav", "hgrunt/move!.wav", "hgrunt/objective!.wav", "hgrunt/yessir!.wav"},
{"scientist/cough.wav", "scientist/dontgothere.wav", "scientist/dontwantdie.wav", "scientist/doyousmell.wav", "scientist/gottogetout.wav"},
{"zombie/zo_pain1.wav", "zombie/zo_attack1.wav", "aslave/slv_die2.wav", "aslave/slv_word5.wav", "zombie/zo_pain2.wav"}
}
new g_hostage_entity[] = "hostage_entity"
new g_hostages[MAX_HOSTAGES]
public plugin_precache() {
for (new i = 0; i < MAX_HOSTAGES; ++i) {
for (new j = 0; j < MAX_PHRASES; ++j) {
precache_sound(g_phrases[i][j])
}
}
}
public plugin_init() {
register_plugin("Hostage Voices", "0.1.1", "VEN")
new ent = - 1, count = 0, classname[] = "classname"
while (count < MAX_HOSTAGES && (ent = engfunc(EngFunc_FindEntityByString, ent, classname, g_hostage_entity))) {
g_hostages[count] = ent
count++
}
register_forward(FM_EmitSound, "forward_emit_sound")
}
public forward_emit_sound(entity, channel, sample[], Float:volume, Float:attenuation, flags, pitch) {
if (!pev_valid(entity))
return FMRES_IGNORED
new i
for (i = 0; i < MAX_HOSTAGES; ++i) {
if (g_hostages[i] == entity)
break
}
if (i == MAX_HOSTAGES)
return FMRES_IGNORED
emit_sound(entity, channel, g_phrases[i][random(MAX_PHRASES)], volume, attenuation, flags, pitch)
return FMRES_SUPERCEDE
}