Raised This Month: $51 Target: $400
 12% 

How to Block Sounds


Post New Thread Reply   
 
Thread Tools Display Modes
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-11-2008 , 13:50   Re: How to Block Sounds
Reply With Quote #21

OK. Look at this:

Code:
public hs(id, value)
{
          new hsmode[4] 
          get_cvar_string("hs_mode", hsmode, 4) 
          new hsmode_bit = read_flags(hsmode)
 
          if (hsmode_bit)
          {
                    client_cmd(id, "spk misc/headshot.wav")
          }
}
When someone does a HS being near to me, I can hear the sound too. I want the sound only to be heared by the one who did the HS.

Last edited by hleV; 02-11-2008 at 13:56.
hleV is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 02-12-2008 , 10:41   Re: How to Block Sounds
Reply With Quote #22

Four possible reasons for that:
  • hs() is being called more than once with a different value of id
  • id is being passed as 0
  • you didn't block the sound in the first place
  • somebody coincidently threw a grenade outside your window
Show the complete code.

Actually, what you need to do is edit your stats plugin. There's really no point in modifying Counter-Strike only to block those changes.

In the case of (1.76d - I would imagine it's the same) miscstats, remove the following line.
.
Code:
        if (HeadShotKillSound)         {             client_cmd(killer, "spk misc/headshot")
            client_cmd(victim, "spk misc/headshot")
        }

Last edited by Lee; 05-18-2012 at 07:50.
Lee is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-12-2008 , 11:05   Re: How to Block Sounds
Reply With Quote #23

Solved.

Last edited by hleV; 02-12-2008 at 12:46.
hleV is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 02-12-2008 , 11:15   Re: How to Block Sounds
Reply With Quote #24

Use [pawn] tags.

Code:
register_event("DeathMsg", "hs", "c", "3=1")
Code:
public hs(id, value) {           new hsmode[5]           get_cvar_string("hs_mode", hsmode, 4)           if (read_flags(hsmode))           {                     client_cmd(read_data(1), "spk misc/headshot.wav")           } }
The plugin has other bugs.. you shouldn't put 5 characters in an array with 5 elements - the last element is reserved for a zero terminator.

Last edited by Lee; 02-12-2008 at 11:27.
Lee is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-12-2008 , 12:46   Re: How to Block Sounds
Reply With Quote #25

Thanks man, you've really helped a lot.
hleV is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 02-12-2008 , 13:56   Re: How to Block Sounds
Reply With Quote #26

is there a way to block/replace weapons/knife_deploy1.wav in cs ?
__________________
Voi is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 02-12-2008 , 14:47   Re: How to Block Sounds
Reply With Quote #27

Quote:
Originally Posted by Voi View Post
is there a way to block/replace weapons/knife_deploy1.wav in cs ?
Hook the sound "weapons/knife_deploy1.wav" like Wilson did, then use emit_sound(id, ...) , and return SUPERCEDE.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 02-12-2008 , 15:36   Re: How to Block Sounds
Reply With Quote #28

Code:
public EmitSound(id, channel, sample[])
{
    if(!is_user_alive(id) || !is_user_connected(id)) 
        return FMRES_IGNORED

    new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
    if(weapon == CSW_KNIFE)
    {

    
            if(equal(sample, "weapons/knife_hit", 17)) 
            {
                new pitch = random_num(75, 125)


                new Float:volume = random_float(0.5, 1.0)

                emit_sound(id, CHAN_WEAPON, "weapons/bullet_hit2.wav", volume, ATTN_NORM, 0, pitch)
                return FMRES_SUPERCEDE

            else if(equal(sample,"weapons/knife_stab.wav")) 
            {
                emit_sound(id, CHAN_WEAPON, "weapons/cbar_hitbod2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
                odrzut2(id)
                return FMRES_SUPERCEDE
            }
            else if(equal(sample,"weapons/knife_hitwall1.wav"))
            {
                emit_sound(id, CHAN_WEAPON, "weapons/cbar_hitbod1.wav", 1.0, ATTN_NORM, 0, PITCH_LOW)
                odrzut2(id)
                return FMRES_SUPERCEDE            
            }
            else if(equal(sample,"weapons/knife_slash1.wav"))
            {
                odrzut2(id)
                return FMRES_SUPERCEDE            
            }
            else if(equal(sample,"weapons/knife_slash2.wav"))
            {
                odrzut2(id)
                return FMRES_SUPERCEDE            
            }
            else if(equal(sample,"weapons/knife_deploy1.wav"))
            {
                return FMRES_SUPERCEDE            
            }

        
    }
    return FMRES_IGNORED
}
__________________
Voi is offline
SpiritVII
New Member
Join Date: Dec 2008
Location: On my computer
Old 02-27-2009 , 23:32   Re: How to Block Sounds
Reply With Quote #29

I'm trying to use this tutorial to block the "Negative!" radio comm from players in Day of Defeat.

What's wrong with just doing this?:

Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fakemeta> 

#define PLUGIN "No Negging"

new g_soundlist[3][64] = 
{
    "player/britnegative.wav", 
    "player/gernegative.wav", 
    "player/usnegative.wav"
}

public plugin_init() {
    register_forward(FM_EmitSound, "block_sound")
}

public block_sound(entity, channel, const sound[]) {
    
    new g_listsize = sizeof g_soundlist 
    for(new i; i<g_listsize; i++)
    {
    if( equali(sound, g_soundlist[i]) )
        return FMRES_SUPERCEDE
    }
    return FMRES_IGNORED
}
Forgive me if I'm too much of a noob, I looked all over for a script that does this and I can't seem to find one anywhere, so I'm trying my hardest to make one myself. Plus I'm interested in scripting. Gotta start somewhere.

Thanks for any help.

Last edited by SpiritVII; 02-27-2009 at 23:40. Reason: Forgot to include what game/mod it was for
SpiritVII is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 06-12-2010 , 23:12   Re: How to Block Sounds
Reply With Quote #30

Excellent tutorial!

Thank you very much!
This code & tutorial helped me alot!

Hope you come back !
__________________
_____________
/_____\
[° ||| °]
./..............\▓
cs1.7 is offline
Reply



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 21:27.


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