View Single Post
Komodo3000
Junior Member
Join Date: Sep 2017
Old 05-10-2018 , 14:18   Re: [CS:S] Hooking Secondary Knife Attack
Reply With Quote #5

Thanks for your fast replies...

@MasterMind420
Quote:
Originally Posted by MasterMind420 View Post
Use a timer....time exactly when u press attack2. So if it happens 0.3 seconds or whatever after u press the button
I already tried that but soon encountered a problem:
When trying to figure out the exact interval betweet two secondary knife attacks using this code:

PHP Code:
public OnClientAuthorized(client)
{
    
SDKHook(clientSDKHook_TraceAttackOnTraceAttack);
}

public 
Action:OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotypehitboxhitgroup)
{
    
decl String:Weapon[32];            
    
GetClientWeapon(attackerWeaponsizeof(Weapon));
    if(
StrEqual(Weapon[7], "knife"false))
    {
        
PrintToChat(attacker"Attacked with Knife | Time: %f"GetEngineTime());
    }
    return 
Plugin_Continue;

the output is the following.:
PHP Code:
Attacked with Knife Time549.686523
Attacked with Knife 
Time550.781555
Attacked with Knife 
Time551.906555
Attacked with Knife 
Time553.001525
Attacked with Knife 
Time554.111572
Attacked with Knife 
Time555.446594
Attacked with Knife 
Time556.556518 
As you can see the interval is not constant, it varies from '1.09497' to '1.335022'. Using this method is too inaccurate for me.


@Lux
Quote:
Originally Posted by Lux View Post
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
You mean hooking the swing sound of knife attack? That actually would be possible but i never used this method. Where do i get the path of the swing sound?
__________________

Last edited by Komodo3000; 05-10-2018 at 14:20.
Komodo3000 is offline