Page 1 of 1

How to block the 'Fire in the hole.' sound in CSS?

Posted: Thu Mar 31, 2016 5:47 pm
by BackRaw
Hi,

as the title says, is there a way to do so?

Thanks in advance :D

Posted: Thu Mar 31, 2016 5:53 pm
by iPlayer
Yes, there's a way. I believe this is done by hooking SendUserMessage. There was a talk on that recently in a thread right below yours http://forums.sourcepython.com/showthread.php?1138-Modifying-chat-with-sayfilter-but-SayCommand-doesnt-quot-register-quot&p=7381&viewfull=1#post7381

Posted: Thu Mar 31, 2016 6:08 pm
by BackRaw
Awesome, thanks. I'll be looking forward for any updates on this :D

Posted: Thu Mar 31, 2016 6:13 pm
by Ayuto
The user message you would want to hook is RadioText. However, there is a function called UTIL_CSRadioMessage() which is used by the engine to create the user message. So, you can simply hook this function instead:

Syntax: Select all

from core import PLATFORM

import memory

from memory import Convention
from memory import DataType

from memory.hooks import PreHook

server = memory.find_binary('server')

# UTIL_CSRadioMessage(IRecipientFilter &, int, int, char const*, char const*, char const*, char const*, char const*)
if PLATFORM == 'windows':
identifier = b'\x55\x8B\xEC\x68\x2A\x2A\x2A\x2A\x8B\x45\x08'
else:
identifier = '_Z19UTIL_CSRadioMessageR16IRecipientFilteriiPKcS2_S2_S2_S2_'

UTIL_CSRadioMessage = server[identifier].make_function(
Convention.CDECL,
[DataType.POINTER, DataType.INT, DataType.INT, DataType.STRING, DataType.STRING, DataType.STRING, DataType.STRING, DataType.STRING],
DataType.VOID
)

@PreHook(UTIL_CSRadioMessage)
def pre_radio_message(args):
if args[6] == '#Cstrike_TitlesTXT_Fire_in_the_hole':
return False

Posted: Thu Mar 31, 2016 6:37 pm
by satoon101
Well, he asked for the sound not the message. I thought they added a convar for that (at least the message), but I can't seem to find it on my phone.

*Edit: found it, it's sv_ignoregrenaderadio

I remembered I created an ES addon for it: http://addons.eventscripts.com/addons/view/LooneyGrenades

Posted: Thu Mar 31, 2016 6:50 pm
by Ayuto
Oops :o

Posted: Thu Mar 31, 2016 7:51 pm
by iPlayer
My fault

Posted: Thu Mar 31, 2016 9:38 pm
by stonedegg
Radio commands are console commands after all, you can always block them with @commands.client.ClientCommandFilter (would also block the message tho, but you can make a custom SayText for that).
I'm not sure what the exact command for "Fire in the hole" is, but you can simply find it out by printing the currently executed command.

Posted: Thu Mar 31, 2016 11:37 pm
by satoon101
That is not a normal radio command. It only happens when throwing a grenade (of any of the 3 types). It does not call any client command.

Posted: Fri Apr 01, 2016 12:53 pm
by stonedegg
Oh true, I forgot that..

Posted: Fri Apr 01, 2016 7:27 pm
by BackRaw
satoon101 wrote:Well, he asked for the sound not the message. I thought they added a convar for that (at least the message), but I can't seem to find it on my phone.

*Edit: found it, it's sv_ignoregrenaderadio

I remembered I created an ES addon for it: http://addons.eventscripts.com/addons/view/LooneyGrenades


Awesome thank you all! I'll test it as soon as I can :D