# SolvedAimbot Math.

#### BrKTrM

##### Newbie
Full Member
Hi guys, ım trying to do a simple aimbot.. i have x, y, z coordinates of player(me) and enemy. But ı cant calculate coordinates of cross hair.
This is what ım trying to do;
C++:
``````Vector between PlayerVector And Enemy Vector= (PlayerX-EnemyX), (PlayerY-EnemyY), (PlayerZ-EnemyZ)= (X, Y, Z)
Distance=sqrt(X^2+Y^2+Z^2)
For Crosshair X= arctan(Y/X)*180/PI
For Crosshair Y=arccos(Z/Distance)*180/PI``````
But this method didin't work, here is code in c++;
C++:
``````#include <iostream>
#include <windows.h>
#include <cmath>
using namespace std;
int main(){
float PlayerX=0, PlayerY=0, PlayerZ=0, CrosshairX=0, CrosshairY=0, EnemyX=0, EnemyY=0, EnemyZ=0, X, Y, Z, AimX, AimY,Distance;
HWND hwnd=FindWindowA(NULL, "Counter-Strike Source");
DWORD procID;
HANDLE handle=OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
X=DusmanX-PlayerX;
Y=DusmanY-PlayerY;
Z=DusmanZ-PlayerZ;
Distance=sqrt(pow(X,2)+pow(Y,2)+pow(Z,2));
AimX= atan(Y/X)*180/M_PI;
AimY= acos(Z/Distance)*180/M_PI;
WriteProcessMemory(handle, (LPVOID)0x660A32D4, &AimX, sizeof(float), 0);
WriteProcessMemory(handle, (LPVOID)0x660A32D8, &AimY, sizeof(float), 0);
system("pause");
return 0;
}``````

#### Lukor

##### ded
Meme Tier VIP
Fleep Tier Donator
you should use structures to combine consecutive addresses in one rpm
C++:
``````struct position{
float x;
float y;
float z;
}

position playerpos = {0};

ReadProcessMemory(handle, (LPVOID)(0x6477AB70), &playerpos, sizeof(position), 0); //this will read x, y, z in 1 rpm``````
etc

#### Traxin

Escobar Tier VIP
Dank Tier Donator
Well what exactly is the issue? You saying it doesn't work doesn't really explain the problem... Are the angles being modified at all? Is the aimbot aiming at some random location?
Those look an awful lot like dynamic addresses but I hope I don't need to cover dynamic and static addresses right now and that you know what you're doing, somewhat at least.

Check out the Aimbot-Entity List Section, which is where this thread is being moved to actually. More focused.
There's a thread in there with multiple examples of CalcAngle functions for several different engines.

• #### BrKTrM

##### Newbie
Full Member
Well what exactly is the issue? You saying it doesn't work doesn't really explain the problem... Are the angles being modified at all? Is the aimbot aiming at some random location?
Those look an awful lot like dynamic addresses but I hope I don't need to cover dynamic and static addresses right now and that you know what you're doing, somewhat at least.

Check out the Aimbot-Entity List Section, which is where this thread is being moved to actually. More focused.
There's a thread in there with multiple examples of CalcAngle functions for several different engines.
İ find out why its not working. Crosshair Adresses were wrong Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language 