well i think no one ever released this for crossfire soo here it go:
place it in your intersectsegment hook or use intersectsegment directly.
Code:
void Trigger(CPlayerInfo* pTarget)
{
IntersectQuery iQuery;
IntersectInfo iInfo;
RtlSecureZeroMemory(&iQuery, sizeof(IntersectQuery));
RtlSecureZeroMemory(&iInfo, sizeof(IntersectInfo));
D3DXVECTOR3 Src /*your eye position, the best would be your weapon position, where the bullet comes out*/,
End,
CameraPos /*the camera pos from playerclient class, there's 3 values which are READONLY, use reclass to find it and use those values*/;
Math::AngleVectors(CameraPos, &End);
//TODO: find a way to get your local player weapon id, get the weapon by index and set the weapon range above.
iQuery.Start = Src;
iQuery.End = Src + (End * 8162.f/*this value is your gun range btw*/);
iQuery.Flags = INTERSECT_HPOLY | INTERSECT_OBJECTS | IGNORE_NONSOLID;
iQuery.FilterIntersectParam = &iQuery;
//iQuery.FilterIntersectFn; you should implement that too...
if (oIntersectSegment(iQuery, &iInfo))
{
if (iInfo.hObjImpact == pTarget->iObject)
{
//shoot
}
}
}