I have the following code. I'm trying to get the person's name I am aiming at. The problem is I need it to be able to go through every wall or trigger until it hits a person.
Code:
public bool:TraceRayDontHitSelf(entity, mask, any:data)
{
if(entity == data)
return false;
return true;
}
public GetPlayerTarget(client)
{
new ret = -1;
new Float:pos[3], Float:ang[3];
GetClientEyePosition(client, pos);
GetClientEyeAngles(client, ang);
TR_TraceRayFilter(pos, ang, MASK_SHOT, RayType_Infinite, TraceRayDontHitSelf, client);
if(TR_DidHit() == true)
{
new ent = TR_GetEntityIndex();
if(ent > 0 && ent < MAXPLAYERS)
ret = ent;
}
return ret;
}
__________________