Why this plugin crash compiler?Also,online compiler is also crashed,it says:
Awww! The compiler crashed! (Segfault)
Something seems to be very wrong in your code...
If you're sure that your code is correct,
you may have discovered a compiler bug...
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define MAX_HOSTAGES 4
#define MAX_PHRASES 4
new g_phrases[MAX_HOSTAGES][MAX_PHRASES][] = {
{"scientist/c1a3_sci_atlast.wav", "scientist/c1a3_sci_thankgod.wav", "scientist/c1a2_sci_1zomb.wav"},
{"scientist/hello.wav", "scientist/yesok.wav", "scientist/doyousmell.wav", "scientist/c1a3_sci_thankgod.wav"},
{"scientist/doyousmell.wav", "scientist/dontwantdie.wav", "scientist/gottogetout.wav", "scientist/hellothere.wav"},
{"scientist/hellothere.wav", "scientist/yesletsgo.wav", "scientist/c1a3_sci_thankgod.wav", "scientist/yesok.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
}