void CESP::Aimbot(void)
{
if (GetAsyncKeyState(0x02))
{
for (int i = 1; i < 130; i++)
{
if (Functions.Distance(Matrix[0].Position, Matrix[i].Position) < 1000)
{
D3DXVECTOR3 footPosition, footScreen, headPosition, headScreen;
footPosition.x = Matrix[i].Position.x;
footPosition.y = Matrix[i].Position.y;
footPosition.z = Matrix[i].Position.z - 1.0;
headPosition.x = Matrix[i].Position.x;
headPosition.y = Matrix[i].Position.y;
headPosition.z = Matrix[i].Position.z + 0.9;
if (Functions.WorldToScreen(&footPosition, &footScreen) && Functions.WorldToScreen(&headPosition, &headScreen))
{
int Height = footScreen.y - headScreen.y;
int Width = Height / 2.5;
int CrosshairX, CrosshairY;
CrosshairX = DirectX.Width / 1.885;
CrosshairY = DirectX.Height / 2.50;
if (Functions.WeaponSlot[0] == 6)
{
CrosshairX = DirectX.Center.x;
CrosshairY = DirectX.Center.y;
}
float Difference, Smooth;
if ((CrosshairX > headScreen.x - (Width * 2) && CrosshairX < headScreen.x + (Width * 2)) && (CrosshairY > headScreen.y && CrosshairY < headScreen.y + Height))
{
if (Menu.Items[CHEAT_AIMBOT].Value)
{
if (Menu.Items[CHEAT_AUTOSHOT].Value)
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Shot, 0, 0, 0);
DWORD KameraX = 0xB6F9CC;
DWORD KameraY = 0xB6F9D0;
float * ViewX = (float*)0xB6F258;
D3DXVECTOR3 Position, Camera;
Camera.x = *(float*)KameraX;
Camera.y = *(float*)KameraY;
Position.x = Camera.x - headPosition.x;
Position.y = Camera.y - headPosition.y;
if (Functions.WeaponSlot[0] == 6)
{
Position.x = Matrix[0].Position.x - headPosition.x;
Position.y = Matrix[0].Position.y - headPosition.y;
}
float Dist = sqrt((Position.x * Position.x) + (Position.y * Position.y));
float One = acosf(Position.x / Dist);
if (Position.x <= 0.0 && Position.y >= 0.0 || Position.x >= 0.0 && Position.y >= 0.0)
{
if (Functions.WeaponSlot[0] == 6)
Difference = (One)-*ViewX;
else
Difference = (One + 0.0390) - *ViewX;
}
if (Position.x >= 0.0 && Position.y <= 0.0 || Position.x <= 0.0 && Position.y <= 0.0)
{
if (Functions.WeaponSlot[0] == 6)
Difference = (-One) - *ViewX;
else
Difference = (-One + 0.0390) - *ViewX;
}
Smooth = Difference / Menu.Items[CHEAT_SMOOTH].Value;
if (Smooth > -1.0 && Smooth < 0.5 && Difference > -2.0 && Difference < 2.0)
*ViewX += Smooth;
}
}
}
}
}
}
}