I have reduced my code alot so that it is easier to see what i want to do.

I have decided me to write at first a little program which aims only on the enemy but my bot aims on everything but not on my enemy ...

I have read the player position and my own position with cheat engine. I there a problem with my x y z stuff?

My player pos x?y?z? = HP address - 0x48

Enemy player pos x?y?z? = Enemy HP address - 0x48

Would be nice if someone could give me a hint.

C++:

```
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
// x?y?z?
float myPos[3] = {-1463.627441 , 64.03124237, 112.3842621 };
float ePos[3] = {102.125, -970.25, 20 };
float angles[3];
CalcAngle( myPos, ePos, angles );
cout<<angles[0]<<"\n";
cout<<angles[1]<<"\n";
cout<<angles[2]<<"\n";
unsigned addr = GetDllBaseAddress( ProcessId, ProcessName, "engine.dll" );
addr = addr + 0x4ca9b8;
// get the first pointer
ReadProcessMemory( ProcessHandle, reinterpret_cast<void*>(addr), &addr, sizeof(float), 0);
// calculate values to get the right view_angle address
addr = addr + 0x8 + 0x4c80;
// aim on enemy
WriteProcessMemory( ProcessHandle, reinterpret_cast<void*>(addr), &angles[0], 12, 0);
system("PAUSE");
return 0;
}
void CalcAngle( float *src, float *dst, float *angles )
{
double delta[3] = { (src[0]-dst[0]), (src[1]-dst[1]), (src[2]-dst[2]) };
double hyp = sqrt(delta[0]*delta[0] + delta[1]*delta[1]);
angles[0] = (float) (asinf(delta[2]/hyp) * 57.295779513082f);
angles[1] = (float) (atanf(delta[1]/delta[0]) * 57.295779513082f);
angles[2] = 0.0f;
if(delta[0] >= 0.0) { angles[1] += 180.0f; }
}
```