Raised This Month: $32 Target: $400
 8% 

CSGO: Mute the sound of a knife hitting a friendly target


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fakuivan
Senior Member
Join Date: Nov 2015
Old 10-06-2018 , 01:01   CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #1

How would I mute the hit sound of the knife hitting a friendly target? This would be handy on jailbreak servers.
__________________
fakuivan is offline
cra88y
AlliedModders Donor
Join Date: Dec 2016
Old 10-06-2018 , 01:25   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #2

Emit sound hook.. and check teams?
cra88y is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 10-06-2018 , 01:45   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #3

NormalSHook covers the blocking part, but I need to get the attacker and the target. How can I hook a friendly knifing when no damage is done to the target?
__________________

Last edited by fakuivan; 10-06-2018 at 01:46.
fakuivan is offline
cra88y
AlliedModders Donor
Join Date: Dec 2016
Old 10-06-2018 , 01:55   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #4

First solution that comes to mind would be using something like
GetClientAimTarget(client, true);

But there's probably a better solution.

EDIT:
NormalSHook has an entity parameter, which would probably just be the client right? So you can just check the client against the client array, and remove all the ones that are your teammates.

Also your own knife sounds are client side so keep that in mind when testing anything. (this may mean that it'd be more practical to just remove all knife sounds that aren't your own)

Last edited by cra88y; 10-06-2018 at 02:07.
cra88y is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 10-06-2018 , 02:51   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #5

I'd like the knife sound to be muted when the player knifes a teammate, when there's no damage is done.
I think it'd be more reasonable for the entity index to be the player's weapon, the knife in this case
__________________
fakuivan is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-06-2018 , 06:12   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #6

Quote:
Originally Posted by fakuivan View Post
I'd like the knife sound to be muted when the player knifes a teammate, when there's no damage is done.
I think it'd be more reasonable for the entity index to be the player's weapon, the knife in this case
Easy, check my Knife Headshot plugin and see how I connect player_hurt and player_death on the same situation. Do the same but it will only work if SDKHook_TraceAttackPost comes BEFORE AddNormalSoundHook. If it doesn't, try SDKHook_TraceAttack.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 10-06-2018 , 10:56   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #7

I assume you store a payload as a global state on the first call and then wait for the other call to complete the action. I wonder if that doesn't generate any concurrency problems if the game and the sound loop live on different threads, I'd think they don't (because I haven't seen any threading resources on the API).
__________________
fakuivan is offline
fakuivan
Senior Member
Join Date: Nov 2015
Old 10-08-2018 , 00:41   Re: CSGO: Mute the sound of a knife hitting a friendly target
Reply With Quote #8

This is how I implemented it:
https://github.com/fakuivan/CSGO-Mut...dly_knifing.sp
__________________
fakuivan 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 18:45.


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