Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Vector3
- {
- float X;
- float Y;
- float Z;
- };
- void aimbot()
- {
- if (GetKeyState(VK_LBUTTON) & 0x80)
- {
- getClosestEntity();
- if (AimbotVictim.ID > -1 && AimbotVictim.ID <= 64)
- {
- std::cout << endl;
- std::cout << "VICTIM :\t" << AimbotVictim.ID << endl;
- std::cout << "FOV :\t" << aimbotBestFOV << endl;
- std::cout << "Health :\t" << EntityList[AimbotVictim.ID].health << endl;
- std::cout << "Team :\t" << EntityList[AimbotVictim.ID].team << endl;
- std::system("cls");
- // Write ViewAngle
- DWORD enginePointer = mem.Read<DWORD>(engineDLL + enginePointerOffset);
- mem.Write<float>(enginePointer + setViewAngle, AimbotVictim.pitch);
- mem.Write<float>(enginePointer + (setViewAngle + 4), AimbotVictim.yaw);
- }
- }
- }
- void getClosestEntity()
- {
- aimbotBestFOV = 360.0f;
- AimbotVictim.ID = -1;
- for (int i = 0; i < 64; i++)
- {
- if (EntityList[i].health > 0 && EntityList[i].team != LocalPlayer.team)
- {
- Vector3 localPlayerEyes;
- localPlayerEyes.X = LocalPlayer.vecOrigin[0] + LocalPlayer.vecViewOffset[0];
- localPlayerEyes.Y = LocalPlayer.vecOrigin[1] + LocalPlayer.vecViewOffset[1];
- localPlayerEyes.Z = LocalPlayer.vecOrigin[2] + LocalPlayer.vecViewOffset[2];
- Vector3 targetAngles;
- calcAngle(localPlayerEyes, EntityList[i].headBoneXYZ, targetAngles);
- AimbotVictim.pitch = targetAngles.X;
- AimbotVictim.yaw = targetAngles.Y;
- float fov = getFOV(LocalPlayer.viewAngle, localPlayerEyes, targetAngles);
- if (fov < aimbotBestFOV)
- {
- aimbotBestFOV = fov;
- AimbotVictim.ID = i;
- }
- }
- }
- }
- void makeVector(Vector3 angle, Vector3 &vector)
- {
- float pitch;
- float yaw;
- float tmp;
- pitch = (float)(angle.X * M_PI / 180);
- yaw = (float)(angle.Y * M_PI / 180);
- tmp = (float)cos(pitch);
- vector.X = (float)(-tmp * -cos(yaw));
- vector.Y = (float)(sin(yaw)*tmp);
- vector.Z = (float)-sin(pitch);
- }
- void calcAngle(Vector3 &src, Vector3 &dst, Vector3 &angles)
- {
- double delta[3] = { (src.X - dst.X), (src.Y - dst.Y), (src.Z - dst.Z) };
- double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
- angles.X = (float)(atan(delta[2] / hyp) * M_RADPI);
- angles.Y = (float)(atan(delta[1] / delta[0]) * M_RADPI);
- angles.Z = 0.0f;
- if (delta[0] >= 0.0) {
- angles.Y += 180.0f;
- }
- }
- float getFOV(Vector3 angle, Vector3 src, Vector3 dst)
- {
- Vector3 ang, aim;
- float fov;
- calcAngle(src, dst, ang);
- makeVector(angle, aim);
- makeVector(ang, ang);
- float mag_s = sqrt((aim.X * aim.X) + (aim.Y * aim.Y) + (aim.Z * aim.Z));
- float mag_d = sqrt((aim.X * aim.X) + (aim.Y * aim.Y) + (aim.Z * aim.Z));
- float u_dot_v = aim.X * ang.X + aim.Y * ang.Y + aim.Z * ang.Z;
- fov = acos(u_dot_v / (mag_s*mag_d)) * (180.0 / M_PI);
- return fov;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement