Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Silent Assault"
#define VERSION "0.1"
#define AUTHOR "v3x"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_forward(FM_EmitSound, "EmitSound");
}
#define MAX_SOUNDS 20
new g_szSnds[MAX_SOUNDS][] =
{
"doors/doormove2.wav",
"doors/doormove9.wav",
"doors/doormove10.wav",
"doors/doorstop4.wav",
"debris/bustmetal1.wav",
"debris/bustmetal2.wav",
"debris/metal1.wav",
"debris/metal2.wav",
"debris/metal3.wav",
"debris/metal4.wav",
"debris/metal5.wav",
"debris/metal6.wav",
"player/pl_duct1.wav",
"player/pl_duct2.wav",
"player/pl_duct3.wav",
"player/pl_duct4.wav",
"player/pl_ladder1.wav",
"player/pl_ladder2.wav",
"player/pl_ladder3.wav",
"player/pl_ladder4.wav"
}
new bool:g_bActive = false;
public plugin_cfg()
{
new szMap[64];
get_mapname(szMap, 63);
if(containi(szMap, "_assault") != -1)
{
g_bActive = true;
server_print("[AMXX] Silent Assault: ON");
}
else
server_print("[AMXX] Silent Assault: OFF");
}
public EmitSound(entity, channel, const sound[])
{
if(g_bActive)
{
//client_print(0, 3, "[SA] Sound emitted: %s", sound);
for(new iSnd = 0; iSnd < MAX_SOUNDS; iSnd++)
{
if(containi(sound, g_szSnds[iSnd]) != -1)
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
return FMRES_SUPERCEDE; - First of all... why did v3x put a ; after that line? Secondly... it says FMRES_SUPERCEDE returns a value of 4... so does that mean that line means return 4???? I am confused how that stops the sound if it returns a value of 4... unless the tutorial is misleading...
I assume with the name SUPERCEDE tied to it that it means to supercede any other functions/whatever that may be called normally by the forward... and I assume the FMRES_IGNORED; means to ignore anything else that may be called such as the sounds??? yet in tutorial it says FMRES_IGNORED = 1... and why is there a ; there as well???
Can someone clear this up for me and explain what returning those values actually does and if I am right in my assumption of what they do... ty
__________________