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

Hook the Reload Sound


Post New Thread Reply   
 
Thread Tools Display Modes
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 10-10-2018 , 16:25   Re: Hook the Reload Sound
Reply With Quote #11

Quote:
Originally Posted by Neuro Toxin View Post
You can block sounds for others and not yourself.

Your game client predicts your landing sounds and reload and plays them before they they trigger via the server.

Sound you will always hear your own sounds while you can block other clients via sound hook or blocking events.
I can confirm this for landing sounds.
Code:
public Action:Hook_NormalSound(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags)
{
    if(StrContains(sample, "player/land") != -1)
        return Plugin_Handled;
}
This is muting all landing sounds except the one from yourself. It is not working for reloads.
fragnichtnach is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 10-10-2018 , 18:05   Re: Hook the Reload Sound
Reply With Quote #12

Quote:
Originally Posted by Neuro Toxin View Post
Code:
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    if(!dontBroadcast)
    {
        new userid = GetEventInt(event, "userid");
        new client = GetClientOfUserId(userid);
        event.SetBool("dontBroadcast", true);
    }
}
Code:
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    return Plugin_Handled;
}
It didn't work out to mute the reload with by blocking the event. Tested both codes.
fragnichtnach is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 10-10-2018 , 20:25   Re: Hook the Reload Sound
Reply With Quote #13

Does it block the animation of the other player reloading?
__________________
Neuro Toxin is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 10-12-2018 , 05:36   Re: Hook the Reload Sound
Reply With Quote #14

Quote:
Originally Posted by Neuro Toxin View Post
Does it block the animation of the other player reloading?
Code:
public OnPluginStart() 
{
    HookEvent("weapon_reload", OnReload, EventHookMode_Pre);
}
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    if(!dontBroadcast)
        event.SetBool("dontBroadcast", true);
}
or
Code:
public OnPluginStart() 
{
    HookEvent("weapon_reload", OnReload, EventHookMode_Pre);
}
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    return Plugin_Handled;
}
blocks nothing. Neuther the animation nor the sound.
fragnichtnach is offline
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Old 10-12-2018 , 09:29   Re: Hook the Reload Sound
Reply With Quote #15

Quote:
Originally Posted by fragnichtnach View Post
Code:
public OnPluginStart() 
{
    HookEvent("weapon_reload", OnReload, EventHookMode_Pre);
}
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    if(!dontBroadcast)
        event.SetBool("dontBroadcast", true);
}
Take a look at this:
http://sourcemod.net/new-api/events/...adcastDisabled
__________________
Discord (Bara#5006) | My Plugins (GitHub)
You like my work? Support is not a crime.
Bara is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 10-12-2018 , 09:46   Re: Hook the Reload Sound
Reply With Quote #16

Quote:
Originally Posted by fragnichtnach View Post
Code:
public OnPluginStart() 
{
    HookEvent("weapon_reload", OnReload, EventHookMode_Pre);
}
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    if(!dontBroadcast)
        event.SetBool("dontBroadcast", true);
}
or
Code:
public OnPluginStart() 
{
    HookEvent("weapon_reload", OnReload, EventHookMode_Pre);
}
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    return Plugin_Handled;
}
blocks nothing. Neuther the animation nor the sound.
then use sdkhooks with SDKHook_Reload
Ilusion9 is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 10-12-2018 , 10:08   Re: Hook the Reload Sound
Reply With Quote #17

Quote:
Originally Posted by Bara View Post
Code:
public Action OnReload(Event event, char [] name, bool dontBroadcast)
{
    if(!dontBroadcast)
        event.SetBool("BroadcastDisabled",true);
}
Like this? Didn't change anything. Thanks anyway.

Quote:
Originally Posted by Ilusion9 View Post
then use sdkhooks with SDKHook_Reload
will try this.
fragnichtnach is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 10-12-2018 , 12:29   Re: Hook the Reload Sound
Reply With Quote #18

Quote:
Originally Posted by Ilusion9 View Post
then use sdkhooks with SDKHook_Reload
Code:
public void OnEntityCreated(int entity, const char[] classname)
{
    SDKHookEx(entity, SDKHook_SpawnPost, SpawnPost);
}
public void SpawnPost(int entity)
{
    SDKHookEx(entity, SDKHook_Reload, OnWeaponReload);
} 
public Action OnWeaponReload(int weapon)
{
    return Plugin_Stop;
}
This is blocking the reload completely. As well this mutes the shot directly after the reload for yourself and causes your client to start the animation which will be aborted short time later.
I think this is not what I am looking for.

I will sumerize now:
  1. LandingSound
    Can be muted with AddNormalSoundHook! You will just continue listen your own landings.
  2. Reload
    Cannot be muted with:
    - event weapon_reload
    - AddNormalSoundHook

Another question: Does anybody have a link about muting "bullet impacts"? I've tested "AddTempEntHook("Impact", Hook_Impact)" but at least at CS:GO this isn't called.

Last edited by fragnichtnach; 10-12-2018 at 12:34.
fragnichtnach is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 10-12-2018 , 16:03   Re: Hook the Reload Sound
Reply With Quote #19

https://forums.alliedmods.net/showpo...88&postcount=3
__________________
Neuro Toxin is offline
fragnichtnach
AlliedModders Donor
Join Date: Oct 2008
Old 10-13-2018 , 10:07   Re: Hook the Reload Sound
Reply With Quote #20

Quote:
Originally Posted by Neuro Toxin View Post
Yes, the shots are muted inside there but it doesn't mute the impacts.
fragnichtnach 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 12:50.


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