
Originally Posted by
dani-pro2
I got the xyz for player and enemy
Mouse XY
Vector distance for XYZ
I took Atan((Z/X)* 180 / 3.14 / 360)
but then looking through some other aimbot source code
z/x / 360 * 3.14
did not work , please help ?
This is my Code :
#include <iostream>
#include <Windows.h>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
DWORD MX = 0xC84FDC;
DWORD MY = 0xC84FD8;
float MouseX;
DWORD X = 0x13255C8;
DWORD Y = 0x13255CC;
DWORD Z = 0x13255C4;
DWORD enX = X + 0x3184;
DWORD enY = Y + 0x3184;
DWORD enZ = Z + 0x3184;
float pX, pY, pZ;
float eX, eY, eZ;
int VecX;
int VecZ;
//X View
DWORD PID;
float angleA;
float angleP;
float halfCircle = 0xFFFFFFFF / 2;
float newValue;
const double PI = 3.14;
float Hyp;
int main() {
while (true)
{
HWND Cod = FindWindowA(0, ("Call of Duty 4"));
GetWindowThreadProcessId(Cod, &PID);
HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PID);
HANDLE pRead = OpenProcess(PROCESS_VM_READ, FALSE, PID);
ReadProcessMemory(pHandle, (LPVOID)X, &pX, sizeof(pX), 0);
ReadProcessMemory(pHandle, (LPVOID)Y, &pY, sizeof(pY), 0);
ReadProcessMemory(pHandle, (LPVOID)Z, &pZ, sizeof(pZ), 0);
ReadProcessMemory(pHandle, (LPVOID)enX, &eX, sizeof(eX), 0);
ReadProcessMemory(pHandle, (LPVOID)enY, &eY, sizeof(eY), 0);
ReadProcessMemory(pHandle, (LPVOID)enZ, &eZ, sizeof(eZ), 0);
ReadProcessMemory(pRead, (LPVOID)MX, &MouseX, sizeof(MouseX), 0);
cout << "Player Coords" << endl;
cout << "X: " << pX << endl;
cout << "Y: " << pY << endl;
cout << "Z: " << pZ << endl;
cout << endl;
cout << "Enemy Coords: " << endl;
cout << "X: " << eX << endl;
cout << "Y: " << eY << endl;;
cout << "Z: " << eZ << endl;
cout << "X Mouse: " << MouseX << endl;
//sector 1
if (eX > pX && eZ <= pZ)
{
VecX = eX - pX;
VecZ = pZ - eZ;
angleA = atan(VecZ / VecX) * 3.14f * 2 / 360;
cout << "Vector X: " << VecX << endl;
cout << "Vector Z: " << VecZ << endl;
cout << "Hyp: " << sqrt(pow(VecX, 2) + pow(VecZ, 2)) << endl;
Hyp = sqrt(pow(VecX, 2) + pow(VecZ, 2));
angleP = atan2(VecZ , VecX);
cout << endl;
cout << "ANGLE TEST: " << angleP << endl;
cout << endl;
newValue = 180.0f - (180.0f * angleA);
cout << newValue << endl;
//WriteProcessMemory(pHandle, (LPVOID)MX, &newValue, sizeof(newValue), 0);
}
//Sec 2
if (eX <= pX && eZ < pZ)
{
VecX = pX - eX;
VecZ = pZ - eZ;
cout << "Vector X: " << VecX << endl;
cout << "Vector Z: " << VecZ << endl;
cout << "Hyp: " << sqrt(pow(VecX, 2) + pow(VecZ, 2)) << endl;
Hyp = sqrt(pow(VecX, 2) + pow(VecZ, 2));
angleP = atan2(VecZ, VecX);
cout << endl;
cout << "ANGLE TEST: " << angleP << endl;
cout << endl;
angleA = atan(VecZ / VecX) * 3.14f * 2 / 360;
newValue = 0xFFFFFFFF - (0xFFFFFFFF * angleA);
cout << newValue << endl;
//WriteProcessMemory(pHandle, (LPVOID)MX, &newValue, sizeof(newValue), 0);
}
//Sec 3
if (eX < pX && eZ >= pZ)
{
VecX = pX - eX;
VecZ = eZ - pZ;
angleA = atan(VecZ / VecX) * 3.14f * 2 / 360;
cout << "Vector X: " << VecX << endl;
cout << "Vector Z: " << VecZ << endl;
Hyp = sqrt(pow(VecX, 2) + pow(VecZ, 2));
cout << "Hyp: " << Hyp << endl;
cout << endl;
angleP = atan2(VecZ, VecX);
cout << "ANGLE TEST: " << angleP << endl;
cout << endl;
newValue = 0xFFFFFFFF - (0xFFFFFFFF * angleA);
cout << newValue << endl;
//WriteProcessMemory(pHandle, (LPVOID)MX, &newValue, sizeof(newValue), 0);
}
//Sec 4
if (eX >= pX && eZ > pZ)
{
VecX = eX - pX;
VecZ = eZ - pZ;
angleA = atan(VecZ / VecX) * 3.14f * 2 / 360;
Hyp = sqrt(pow(VecX, 2) + pow(VecZ, 2));
angleP = atan2(VecZ, VecX) * 180;
cout << "Vector X: " << VecX << endl;
cout << "Vector Z: " << VecZ << endl;
cout << "Hyp: " << sqrt(pow(VecX, 2) + pow(VecZ, 2)) << endl;
cout << endl;
cout << "ANGLE TEST: " << angleP << endl;
cout << endl;
//newValue = 0xFFFFFFFF - (0xFFFFFFFF * angleA);
newValue = 180 - (180 * angleP);
cout << newValue << endl;
WriteProcessMemory(pHandle, (LPVOID)MX, &newValue, sizeof(newValue), 0);
}
system("CLS");
}
}