How to reset the player's sound to normal on player_blind?
How to reset the player's sound to normal on player_blind?
Hi,
the topic title says it lol. Is it possible? On a PreHook maybe? If so, how would I go about that?
the topic title says it lol. Is it possible? On a PreHook maybe? If so, how would I go about that?
satoon101 wrote:You don't want players to be blinded either, correct? If so, I would say to hook CFlashbang:etonate (not fully sure on the names there). I am at work, so I cannot provide an example till I get home.
*Edit: perhaps CCSPlayer::Blind might work, too. Not sure if that also causes the sound, though.
Alright, I'm not sure if I want players to be blinded or not yet. That's why I have to figure it out


Do you want an anti-flash for everyone or just for some people? In the first case you can just hook CFlashbangProjectile::Detonate().
If you only want to disable that for some specific users, you need to hook CCSPlayer::Deafen() to disable the sound and CCSPlayer::Blind() to disable the blinding part.
If you only want to disable that for some specific users, you need to hook CCSPlayer::Deafen() to disable the sound and CCSPlayer::Blind() to disable the blinding part.
Ayuto wrote:Do you want an anti-flash for everyone or just for some people? In the first case you can just hook CFlashbangProjectile:etonate().
If you only want to disable that for some specific users, you need to hook CCSPlayer:eafen() to disable the sound and CCSPlayer::Blind() to disable the blinding part.
Awesome, thanks. Can i do it the same way you provided here?
http://en.wikipedia.org/wiki/Interactive_Disassembler
But of course you can also use a different disassembler if you want.
But of course you can also use a different disassembler if you want.
Ayuto wrote:http://en.wikipedia.org/wiki/Interactive_Disassembler
But of course you can also use a different disassembler if you want.
Good to know!! Thanks

I have added CFlashbangProjectile::Detonate and CCSPlayer::Blind for CS:S and CS:GO to my data locally. CCSPlayer::Deafen will require a symbol/signature, and seems to be a bit tricky at first glance (no time to work on now, need some sleep). Once we get all 3 added to the repo, you will be able to use/hook them in your scripts more easily.
This is for CS:S:I will take a look at CS:GO's signature later today.
Code: Select all
_ZN9CCSPlayer6DeafenEf
55 8B EC 83 EC 28 89 4D FC 8B 45 FC 8B 10
I have now taken a look at CS:GO and found this signature.However, this is a special function as it uses a custom calling convention on Windows. The "this" pointer is passed through the ecx register (that's usual for a Windows thiscall), but the other argument is passed through the xmm1 register and that's unusual. There is nothing pushed onto the stack. We can still hook the function, but we can't access its arguments.
Code: Select all
55 8B EC 83 EC 28 56 57 8B F9 F3 0F 11 4D FC
Syntax: Select all
import memory
from memory import Convention
from memory import Argument
from memory import Return
from memory.hooks import PreHook
server = memory.find_binary('server')
deafen = server[b'\x55\x8B\xEC\x83\xEC\x28\x56\x57\x8B\xF9\xF3\x0F\x11\x4D\xFC'].make_function(
Convention.THISCALL,
(Argument.POINTER,),
Return.VOID
)
@PreHook(deafen)
def my_hook(args):
print(tuple(args))
return 0
satoon101 wrote:Does this also mean we cannot call that function? Stinks that we can't get the arguments, but at least in this instance I don't think he needs them.
I guess not. I just need the player_blind event to not fire, e.g. return False or something in the pre event function. I only want the players to be flashed visually, so I would do something like this:
Syntax: Select all
@PreEvent
def pre_player_blind(userid):
player = Player(index_from_userid(userid))
# simulate flashing without sound, just visually
player.set_property_float("m_flFlashMaxAlpha", 200.0)
player.set_property_float("m_flFlashDuration", 1.4)
# either set the player's sound somehow
# or stop player_blind from firing
return False
That's not exactly what I meant. I just mean you don't need access to the float value that is passed to CCSPlayer::Deafen. You can still return False from hooking that method to stop the deafening sound from playing. And, if you do want to know which player is being deafened, you have access to that through args[0] (which is a Pointer).
satoon101 wrote:That's not exactly what I meant. I just mean you don't need access to the float value that is passed to CCSPlayer:eafen. You can still return False from hooking that method to stop the deafening sound from playing. And, if you do want to know which player is being deafened, you have access to that through args[0] (which is a Pointer).
Ooooh, true. I have to think about how I want to implement it first

Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 100 guests