Aimbot locking on ground
Hi,
I'm having a issue that my aimbot is locking itself on the ground when I hold the key for it.
Now, the weird thing is is that this exact aimbot works perfectly fine in my other project, the only difference is is that in this project I am not using /CLR. Before, I had the issue that when I started the aimbot it said 'Run-Time Check Failure #3 - The variable 'index' is being used without being initialized.' but I've moved the variable index to above the closestenemytocrosshair code and that seems to be solved now.
I'm having a issue that my aimbot is locking itself on the ground when I hold the key for it.
Now, the weird thing is is that this exact aimbot works perfectly fine in my other project, the only difference is is that in this project I am not using /CLR. Before, I had the issue that when I started the aimbot it said 'Run-Time Check Failure #3 - The variable 'index' is being used without being initialized.' but I've moved the variable index to above the closestenemytocrosshair code and that seems to be solved now.
Code:
void CalcAngle(Vec3 src, Vec3 dst, Vec3 &angles)
{
Vec3 delta;
delta.x = src.x - dst.x;
delta.y = src.y - dst.y;
delta.z = src.z - dst.z;
double hyp = sqrt(delta.x * delta.x + delta.y * delta.y);
angles.x = (float)(atan(delta.z / hyp) * 57.295779513082f);
angles.y = (float)(atan(delta.y / delta.x) * 57.295779513082f);
angles.z = 0.0f;
if (delta.x >= 0.0)
angles.y += 180.0f;
}
int index;
int ClosestEnemyToCrosshair(float maxfov)
{
DWORD LocalPlayer = Mem.Read <DWORD>(Client + 0x00A31504);
int LocalTeam = Mem.Read<int>(LocalPlayer + m_iTeamNum);
for (int i = 0; i < 64; i++)
{
DWORD entitybase = Mem.Read<DWORD>(Client + EntityList + (i * 0x10));
if (entitybase == LocalPlayer)
continue;
bool entitydormant = Mem.Read<bool>(entitybase + isDormant);
if (entitydormant)
continue;
int entityteam = Mem.Read<int>(entitybase + m_iTeamNum);
if (entityteam == LocalTeam)
continue;
int entitylifestate = Mem.Read<byte>(entitybase + 0x25B); //is lifestate
if (entitylifestate != 0)
continue;
DWORD Engine = Mem.Module("engine.dll");
DWORD clientstate = Mem.Read<DWORD>(Engine + clientState);
Vec3 currentangles = Mem.Read<Vec3>(clientstate + viewAngle);
Vec3 pos = BonePos(entitybase, 0x2698, aimbone); //bonematrix
float entitydistance = GetFOV(currentangles, position, pos);
if (entitydistance < maxfov)
{
maxfov = entitydistance;
index = i;
}
}
return index;
}


I have this right now, but it seems to still not be doing anything and I'm out of ideas