Raised This Month: $ Target: $400
 0% 

[CS:GO] Trace attack not called on knife


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pyro_
Senior Member
Join Date: Oct 2013
Old 02-20-2015 , 03:38   [CS:GO] Trace attack not called on knife
Reply With Quote #1

I have:
PHP Code:
for(new 1MaxClientsi++)
    {
        if(
IsClientInGame(i))
        {
            
SDKHook(iSDKHook_TraceAttackOnTraceAttack);
        }
    } 
in event_start hook.

And
PHP Code:
public Action:OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotypehitboxhitgroup)
{
    if(
IsValidEntity(victim))
    {
        if(
shouldntgethit[victim])
        {
            
PrintToChat(victim"You were attacked");
            return 
Plugin_Handled;
        }
    }
    return 
Plugin_Continue;

And if you are shot, the chat message is displayed. But if you are knifed, it isn't and the attack isn't blocked.

NOTE: I am not after invincibility against knives, I want the knife to pass through the player, so if two players are in same place, (one that shouldn't get hit), then the one that should will get knifed

Is there a workaround?

Last edited by Pyro_; 02-20-2015 at 03:38.
Pyro_ is offline
ici
Member
Join Date: Jan 2014
Old 02-20-2015 , 03:58   Re: [CS:GO] Trace attack not called on knife
Reply With Quote #2

You should use OnTakeDamage instead.
ici is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-20-2015 , 09:20   Re: [CS:GO] Trace attack not called on knife
Reply With Quote #3

TraceAttack is only called for hitscan weapons, not melee nor projectile weapons.
psychonic is offline
Pyro_
Senior Member
Join Date: Oct 2013
Old 02-20-2015 , 09:25   Re: [CS:GO] Trace attack not called on knife
Reply With Quote #4

Quote:
Originally Posted by ici View Post
You should use OnTakeDamage instead.
I don't think that will allow the knife to pass through

Quote:
Originally Posted by psychonic View Post
TraceAttack is only called for hitscan weapons, not melee nor projectile weapons.
Hmm, thanks . Is there an equivalent for melee?
Pyro_ is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode