bool PatchedIntersectSegment(IntersectQuery& Query, IntersectInfo* Info) {
DWORD CShellBase = reinterpret_cast<DWORD>(GetModuleHandle("CShell.dll"));
DWORD LTClientShell = *reinterpret_cast<DWORD*>(CShellBase + aLTClientShell);
CFPlayer* MyPlayer = GetPlayerFromIndex(LTClientShell, GetMyPlayersIndex(LTClientShell));
if (IsValidPlayer(MyPlayer, true) && ((MyPlayer -> Health) > 0)) {
for (int ThisPlayerIndex = 0; (ThisPlayerIndex < 16); ThisPlayerIndex++) {
CFPlayer* OtherPlayer = GetPlayerFromIndex(LTClientShell, ThisPlayerIndex);
if (IsValidPlayer(OtherPlayer, false) && !IsMe(MyPlayer, OtherPlayer) && !IsTeammate(MyPlayer, OtherPlayer)) {
D3DXVECTOR3 HitPosition = GetBonePosition((OtherPlayer -> Object), 6);
Query.StartPosition = (HitPosition + D3DXVECTOR3(0.0f, 50.0f, 0.0f));
Query.EndPosition = (HitPosition - D3DXVECTOR3(0.0f, 50.0f, 0.0f));
Query.CollisionFlags = (INTERSECT_OBJECTS | IGNORE_NONSOLID | INTERSECT_HPOLY);
Query.ObjectFilterOne = FilterObjectsCallback;
(Info -> ImpactObject) = (OtherPlayer -> Object);
(Info -> ImpactPosition) = HitPosition;
return true;
};
};
};
return OriginalIntersectSegment(Query, Info);
};

bool mRemotekill(IntersectQuery* rQuery, IntersectInfo* rInfo)
{
int BONE_ID = 6;
switch (MenuRemoteBone)
{
case 1: BONE_ID = 5; break; // Neck
case 2: BONE_ID = 2; break; // Body
case 3: BONE_ID = 10; break; // Left Hand
case 4: BONE_ID = 17; break; // Right Hand
case 5: BONE_ID = 23; break; // Left Foot
case 6: BONE_ID = 28; break; // Right Foot
default: BONE_ID = 6; // Head
}
int TargetIndex = GetNearestBy360();
switch (MenuRemoteMode)
{
case 1: TargetIndex = GetNearestByCrossHair(); break;
case 2: TargetIndex = GetNearestByDistance(); break;
default: TargetIndex = GetNearestBy360();
}
CPlayer* MyPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (TargetIndex != -1)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(TargetIndex);
if (MyPlayer && MyPlayer->Object && TargetPlayer->Object && TargetPlayer->CharacterFx && !TargetPlayer->CharacterFx->IsDead())
{
if(TargetPlayer->Team != MyPlayer->Team)
{
if (MenuRemoteVisibleCheck == 1)
{
if (Engine->IsVisible(Engine->GetBonePosition(MyPlayer->Object, 6), Engine->GetBonePosition(TargetPlayer->Object, 6)) && Engine->isValidClient(TargetPlayer))
{
int IsRemoteKey = VK_LBUTTON;
switch (MenuRemoteKey)
{
case 1: IsRemoteKey = VK_LBUTTON; break;
case 2: IsRemoteKey = VK_RBUTTON; break;
case 3: IsRemoteKey = VK_SHIFT; break;
case 4: IsRemoteKey = VK_MENU; break;
default: IsRemoteKey = VK_LBUTTON;
}
if (GetAsyncKeyState(IsRemoteKey) < 0)
{
D3DXVECTOR3 Pos = Engine->GetBonePosition(TargetPlayer->Object, BONE_ID);
rQuery->m_From = Pos + D3DXVECTOR3(0.0f, 50.0f, 0.0f);
rQuery->m_To = Pos - D3DXVECTOR3(0.0f, 50.0f, 0.0f);
rQuery->m_Flags = ::INTERSECT_OBJECTS|::INTERSECT_HPOLY|::IGNORE_NONSOLID;
rQuery->m_FilterFn = FilterObjects;
bool Result = pIntersectSegment(*rQuery, rInfo);
if (Result)
{
rInfo->hObjImpact = TargetPlayer->Object;
rInfo->vImpactPos = Pos;
}
return pIntersectSegment(*rQuery, rInfo);
}
}
}
}
}
}
return pIntersectSegment(*rQuery, rInfo);
}
class EngineHook
{
public:
EngineHook()
{
memset(this, 0, sizeof(EngineHook));
}
EngineHook(DWORD* ppdwClassBase)
{
bInitialize(ppdwClassBase);
}
~EngineHook()
{
UnHook();
}
bool bInitialize(DWORD* ppdwClassBase)
{
dwClassBase = ppdwClassBase;
m_OldVT = *ppdwClassBase;
*ppdwClassBase = m_OldVT;
return true;
}
void UnHook()
{
if (dwClassBase && m_OldVT)
{
*dwClassBase = m_OldVT;
}
}
void ReHook()
{
if (dwClassBase && m_NewVT)
{
*dwClassBase = m_NewVT;
}
}
DWORD HookFunction(DWORD dwNewFunc)
{
if (m_OldVT)
{
m_NewVT = dwNewFunc;
return m_OldVT;
}
return NULL;
}
private:
DWORD* dwClassBase;
DWORD m_NewVT, m_OldVT;
};
EngineHook* IntersectSegment;
IntersectSegment = new EngineHook((DWORD*)I::IntersectSegment);
oIntersectSegment = (IntersectSegmentFn)IntersectSegment->HookFunction((DWORD)Hooks::hkIntersectSegment);
IntersectSegment->ReHook()
IntersectSegment->UnHook()