Raised This Month: $ Target: $400
 0% 

How does return FMRES_SUPERCEDE; work in this plugin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 03-18-2006 , 13:51   How does return FMRES_SUPERCEDE; work in this plugin?
#1

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
__________________
If you're really bored, check out the plugins I've publicly released.
SubStream is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode