[CS:S] Hooking Secondary Knife Attack
Is there a way to hook secondary knife attack in CS:S?
The 'weapon_fire' event is not fired by secondary attack: PHP Code:
PHP Code:
PHP Code:
PHP Code:
I also need it to work, every time secondary attack is performed and not only when someone is hurt/hit by it, so 'player_hurt' event and 'SDKHook_TraceAttack' is not an option. |
Re: [CS:S] Hooking Secondary Knife Attack
Quote:
|
Re: [CS:S] Hooking Secondary Knife Attack
sound hook should work?
https://sm.alliedmods.net/api/index....d=show&id=787& Only ever tried to mod CSS for viewmodel legs never messed with anything else |
Re: [CS:S] Hooking Secondary Knife Attack
Maybe something like this if the sound hook isn't a reliable method.
PHP Code:
You have to account for weapon draw time and primary attack cool down times as well but this should get you in the right direction. |
Re: [CS:S] Hooking Secondary Knife Attack
Thanks for your fast replies...
@MasterMind420 Quote:
When trying to figure out the exact interval betweet two secondary knife attacks using this code: PHP Code:
PHP Code:
@Lux Quote:
|
Re: [CS:S] Hooking Secondary Knife Attack
you can use "soundlist" command to print all precached sounds in console. There's a few issues with this though, i think the same sound plays for left click stabs as well as right click. There's also probably a lot of specific knife sounds for when you hit materials like metal or flesh that play which aren't specific to being a knife but is equal to a bullet impact sound. The sounds i found are "weapons\knife\knife_hitwall1.wav" and "weapons\knife\knife_stab.wav" for example.
|
Re: [CS:S] Hooking Secondary Knife Attack
PHP Code:
EDIT: After thinking about it this might not be the most accurate method since clicking the button might not always correspond to the secondary attack happening, might need a different method. |
Re: [CS:S] Hooking Secondary Knife Attack
I think the most accurate method may be checking the animation sequence using m_nsequence entprop
|
Re: [CS:S] Hooking Secondary Knife Attack
Quote:
This might be a longshot but. Is the button press in the same gameframe of the sound being emitted? if so we can use the button press to determine which attack is being performed? example in my own way [Framestart] OnPlayerRunCmd Source Processing buttons Starts attack SoundHook checks SoundEmitted [frameend] it maywork. Quote:
Its in old syntax sorry i prefer it. PHP Code:
|
Re: [CS:S] Hooking Secondary Knife Attack
Use SDKHook_OnTakeDamage and add this to your part after you check if the weapon is a knife:
Quote:
|
All times are GMT -4. The time now is 18:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.