Code:
#include "Aimbot.h"
#define PI3 6.283185307179586
void cAimbot::StartAimFov(LPDIRECT3DDEVICE9 pDevice)
{
if (!Engine->IsGameReadyForHook()) return;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
switch (Var_AimFov)
{
case 1: AimFirstView = 2.50f; break; // 10.0f
case 2: AimFirstView = 6.50f; break; // 30.0f
case 3: AimFirstView = 9.50f; break; // 45.0f
case 4: AimFirstView = 12.50f; break; // 60.0f
case 5: AimFirstView = 16.50f; break; // 80.0f
case 6: AimFirstView = 18.50f; break; // 90.0f
case 7: AimFirstView = 32.50f; break; // 180.0f
case 8: AimFirstView = 64.5f; break; // 360.0f
default: AimFirstView = 6.50f;
}
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidClient(LocalPlayer))
{
if (!LocalPlayer->CharacterFx->IsDead())
{
DirectX->DrawCircle(ScreenX, ScreenY, (AimFirstView * 5.0f) * PI3, Yellow, pDevice);
}
}
}
int cAimbot::GetNearestByTargetPlayerAim(LPDIRECT3DDEVICE9 pDevice)
{
int BestTarget = -1;
float MaxDistance = INFINITE;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidClient(LocalPlayer))
{
for (int i = 0; i < Engine->GetMaxPlayer(); i++)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(i);
D3DXVECTOR3 Pos = Engine->GetBonePosition(TargetPlayer->m_Object, 6);
if (!Engine->IsValidClient(TargetPlayer))
continue;
if (!Engine->IsCheckPlayer(TargetPlayer))
continue;
if (Engine->IsTM(LocalPlayer, TargetPlayer))
continue;
// ==================== [ Get Nearest By Crosshair ] ==================== //
if (Var_AimMode == 0)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->GetDistance(Pos.x, Pos.y, ScreenX, ScreenY);
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
// ==================== [ Get Nearest By Distance ] ==================== //
if (Var_AimMode == 1)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->CalculateDistance(LocalPlayer->m_Object->Body, TargetPlayer->m_Object->Body) / 100;
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
}
}
return BestTarget;
}
int cAimbot::GetNearestByTargetZombieAim(LPDIRECT3DDEVICE9 pDevice)
{
int BestTarget = -1;
float MaxDistance = INFINITE;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidClient(LocalPlayer))
{
for (int i = 0; i < Engine->GetMaxPlayer(); i++)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(i);
D3DXVECTOR3 Pos = Engine->GetBonePosition(TargetPlayer->m_Object, 6);
if (!Engine->IsValidClient(TargetPlayer))
continue;
if (!Engine->IsCheckZombie(TargetPlayer))
continue;
if (Engine->IsZM(LocalPlayer, TargetPlayer))
continue;
// ==================== [ Get Nearest By Crosshair ] ==================== //
if (Var_AimMode == 0)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->GetDistance(Pos.x, Pos.y, ScreenX, ScreenY);
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
// ==================== [ Get Nearest By Distance ] ==================== //
if (Var_AimMode == 1)
{
if (Engine->WorldToScreen(pDevice, &Pos))
{
float radiusx = (AimFirstView * 5.0f) * (ScreenX / 100.0f);
float radiusy = (AimFirstView * 5.0f) * (ScreenY / 100.0f);
float Tmp = Esp->CalculateDistance(LocalPlayer->m_Object->Body, TargetPlayer->m_Object->Body) / 100;
if (Pos.x >= ScreenX - radiusx && Pos.x <= ScreenX + radiusx && Pos.y >= ScreenY - radiusy && Pos.y <= ScreenY + radiusy)
{
if (Tmp < MaxDistance)
{
MaxDistance = Tmp;
BestTarget = i;
}
}
}
}
}
}
return BestTarget;
}
void cAimbot::StartAimbot(LPDIRECT3DDEVICE9 pDevice)
{
if (!Engine->IsGameReadyForHook()) return;
D3DVIEWPORT9 ViewP;
pDevice->GetViewport(&ViewP);
float ScreenX = ViewP.Width / 2;
float ScreenY = ViewP.Height / 2;
int BONE_ID = 6;
switch (Var_AimbBone)
{
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
}
if (!Engine->IsRoomInfoZmMode())
{
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidPointer(LocalPlayer))
{
int TargetIndex = this->GetNearestByTargetPlayerAim(pDevice);
if (TargetIndex != -1)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(TargetIndex);
if (Engine->IsValidPointer(TargetPlayer))
{
if (TargetPlayer != LocalPlayer)
{
D3DXVECTOR3 AimPos = Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID);
if (Engine->WorldToScreen(pDevice, &AimPos))
{
float DistX = AimPos.x - ScreenX;
float DistY = AimPos.y - ScreenY;
if (Var_AimVisibleCheck == 0)
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
else if (Var_AimVisibleCheck == 1)
{
if (Engine->IsVisible(Engine->GetBonePosition(LocalPlayer->m_Object, BONE_ID), Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID)))
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
}
}
}
}
}
}
}
else if (Engine->IsRoomInfoZmMode())
{
CPlayer* LocalPlayer = Engine->GetPlayerByIndex(Engine->GetMyIndex());
if (Engine->IsValidPointer(LocalPlayer))
{
int TargetIndex = this->GetNearestByTargetZombieAim(pDevice);
if (TargetIndex != -1)
{
CPlayer* TargetPlayer = Engine->GetPlayerByIndex(TargetIndex);
if (Engine->IsValidPointer(TargetPlayer))
{
if (TargetPlayer->CharacterFx->IsMutant() != LocalPlayer->CharacterFx->IsMutant())
{
D3DXVECTOR3 AimPos = Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID);
if (Engine->WorldToScreen(pDevice, &AimPos))
{
float DistX = AimPos.x - ScreenX;
float DistY = AimPos.y - ScreenY;
if (Var_AimVisibleCheck == 0)
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
else if (Var_AimVisibleCheck == 1)
{
if (Engine->IsVisible(Engine->GetBonePosition(LocalPlayer->m_Object, BONE_ID), Engine->GetBonePosition(TargetPlayer->m_Object, BONE_ID)))
{
switch (Var_AimKey)
{
case 1: if (GetAsyncKeyState(VK_LBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 2: if (GetAsyncKeyState(VK_RBUTTON)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 3: if (GetAsyncKeyState(VK_SHIFT)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
case 4: if (GetAsyncKeyState(VK_MENU)) mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL); break;
default: mouse_event(MOUSEEVENTF_MOVE, (float)DistX, (float)DistY, 0, NULL);
}
}
}
}
}
}
}
}
}
}