AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound Fire in the Hole (https://forums.alliedmods.net/showthread.php?t=82881)

TotalCS 12-31-2008 11:38

Sound Fire in the Hole
 
Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Sound Blocker"
#define VERSION "1.0"
#define AUTHOR "anakin_cstrike"

new const oldsound[] = "radio/ct_fireinhole.wav";
new const newsound[] = "misc/grenada.wav";

new g_maxplayers;

public plugin_init()
{
  register_plugin(PLUGIN, VERSION, AUTHOR)
  register_forward( FM_EmitSound, "fw_emitsound" );
 
  g_maxplayers = get_maxplayers();
}
public plugin_precache()
  engfunc( EngFunc_PrecacheSound, newsound );
 
public fw_emitsound( Ent, Channel, const Sound[], Float:Volume, Float:Attenuation, Flags, Pitch )
{
  if( !equali( Sound, oldsound ) )
      return FMRES_IGNORED;
     
  static owner, team, i;
  owner = pev( Ent, pev_owner );
  team = get_user_team( owner );
 
  for( i = 1; i <= g_maxplayers; i++ )
  {
      if( !is_user_connected( i ) )
        continue;
      if( get_user_team( i ) != team )
        continue;
       
      emit_sound( i, CHAN_ITEM, newsound, Volume, Attenuation, Flags, Pitch );
      return FMRES_SUPERCEDE;
  }
 
  return FMRES_IGNORED;
}

It compiles well but i can`t hear the sound :cry:

ConnorMcLeod 12-31-2008 12:24

Re: Sound Fire in the Hole
 
FM_EmitSound is not triggered for this sound.

Hook SendAudio message using register_message, then all you have to do is change the string %MRAD_XXX to the name of the (precached) sound you want, and no need to do any loop.

TotalCS 12-31-2008 12:28

Re: Sound Fire in the Hole
 
Quote:

Originally Posted by ConnorMcLeod (Post 736127)
FM_EmitSound is not triggered for this sound.

Hook SendAudio message using register_message, then all you have to do is change the string %MRAD_XXX to the name of the (precached) sound you want, and no need to do any loop.

Can you fix it?:|

ConnorMcLeod 12-31-2008 13:04

Re: Sound Fire in the Hole
 
1 Attachment(s)
Rewritten.

TotalCS 12-31-2008 13:14

Re: Sound Fire in the Hole
 
It works but the when the round starts i hear the sound without throwing a grenade

ConnorMcLeod 12-31-2008 13:29

Re: Sound Fire in the Hole
 
I'm stupid, re-DL.

TotalCS 01-01-2009 05:35

Re: Sound Fire in the Hole
 
Quote:

Originally Posted by ConnorMcLeod (Post 736149)
I'm stupid, re-DL.

Thx, +karma :)

MustD1e 05-16-2012 12:14

Re: Sound Fire in the Hole
 
Hello, I get (when throw grenade)
Quote:

FATAL ERROR
PW_WRITE_STRING_I_called with no active message
And there too http://forums.alliedmods.net/showthr...t=67294&page=2


All times are GMT -4. The time now is 09:11.

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