View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-02-2021 , 17:42   Re: trace ray not hitting head
Reply With Quote #5

yep. Show your code next time...
*I quick tested in cs:go tough...


PHP Code:
#include <sdktools>

// ---------------------------
//  Hit Group standards
// ---------------------------
#define        HITGROUP_GENERIC    0
#define        HITGROUP_HEAD        1
#define        HITGROUP_CHEST        2
#define        HITGROUP_STOMACH    3
#define        HITGROUP_LEFTARM    4    
#define        HITGROUP_RIGHTARM    5
#define        HITGROUP_LEFTLEG    6
#define        HITGROUP_RIGHTLEG    7
#define        HITGROUP_GEAR        10            // alerts NPC, but doesn't do damage or bleed (1/100th damage)



public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{
    
float eyespos[3];
    
GetClientEyePosition(clienteyespos);
    
float eyesang[3];
    
GetClientEyeAngles(clienteyesang);

    
Handle Ray TR_TraceRayFilterEx(eyesposeyesangMASK_SHOTRayType_Infinitefilterclient);
    
int index TR_GetEntityIndex(Ray);
    
int hitgroup TR_GetHitGroup(Ray);

    if(
index && hitgroup == HITGROUP_HEAD)
        
PrintToServer("%N HitBoxIndex %i HitGroup %i"indexTR_GetHitBoxIndex(Ray), hitgroup);
    
    
delete Ray;
    


    return 
Plugin_Handled;
}



public 
bool filter(int entityint contentsMaskany data)
{
    
// Don't look yourself, only client indexes
    
if(entity != data && entity && entity <= MaxClients) return true;

    return 
false;


Last edited by Bacardi; 04-02-2021 at 19:31.
Bacardi is offline