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

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

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

Postby BackRaw » Thu Mar 31, 2016 5:47 pm

Hi,

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

Thanks in advance :D
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Thu Mar 31, 2016 5:53 pm

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
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Thu Mar 31, 2016 6:08 pm

Awesome, thanks. I'll be looking forward for any updates on this :D
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Thu Mar 31, 2016 6:13 pm

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
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Mar 31, 2016 6:37 pm

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
Image
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Thu Mar 31, 2016 6:50 pm

Oops :o
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Thu Mar 31, 2016 7:51 pm

My fault
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Thu Mar 31, 2016 9:38 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Thu Mar 31, 2016 11:37 pm

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.
Image
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Fri Apr 01, 2016 12:53 pm

Oh true, I forgot that..
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Fri Apr 01, 2016 7:27 pm

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
My Github repositories:

Source.Python: https://github.com/backraw

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 21 guests