Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWORD PlayertoAim = 0; //Our player adress
- bool isaimbotting = false; //Can be useful
- enum E_Bones // 62
- {
- Bip01 = 0,
- Bip01_Pelvis = 1,
- Bip01_Spine = 2,
- Bip01_Spine1 = 3,
- Bip01_Spine2 = 4,
- Bip01_Neck = 5,
- Bip01_Head = 6,
- Bip01_L_Clavicle = 7,
- Bip01_L_UpperArm = 8,
- Bip01_L_Forearm = 9,
- Bip01_L_Hand = 10,
- Bip01_L_Finger0 = 11,
- Bip01_L_Finger01 = 12,
- Bip01_L_Finger02 = 13,
- Bip01_L_Finger1 = 14,
- Bip01_L_Finger11 = 15,
- Bip01_L_Finger12 = 16,
- Bip01_L_Finger2 = 17,
- Bip01_L_Finger21 = 18,
- Bip01_L_Finger22 = 19,
- Bip01_L_Finger3 = 20,
- Bip01_L_Finger31 = 21,
- Bip01_L_Finger32 = 22,
- Bip01_L_Finger4 = 23,
- Bip01_L_Finger41 = 24,
- Bip01_L_Finger42 = 25,
- Bip01_L_ForeTwist = 26,
- Bip01_L_ForeTwist1 = 27,
- Bip01_R_Clavicle = 28,
- Bip01_R_UpperArm = 29,
- Bip01_R_Forearm = 30,
- Bip01_R_Hand = 31,
- Bip01_R_Finger0 = 32,
- Bip01_R_Finger01 = 33,
- Bip01_R_Finger02 = 34,
- Bip01_R_Finger1 = 35,
- Bip01_R_Finger11 = 36,
- Bip01_R_Finger12 = 37,
- Bip01_R_Finger2 = 38,
- Bip01_R_Finger21 = 39,
- Bip01_R_Finger22 = 40,
- Bip01_R_Finger3 = 41,
- Bip01_R_Finger31 = 42,
- Bip01_R_Finger32 = 43,
- Bip01_R_Finger4 = 44,
- Bip01_R_Finger41 = 45,
- Bip01_R_Finger42 = 46,
- PrimaryWeaponBone = 47,
- Bip01_R_ForeTwist = 48,
- Bip01_R_ForeTwist1 = 49,
- Weapon_BackLeft = 50,
- Weapon_BackRPG = 51,
- Weapon_BackRight = 52,
- Bip01_L_Thigh = 53,
- Bip01_L_Calf = 54,
- Bip01_L_Foot = 55,
- Bip01_L_Toe0 = 56,
- Weapon_Side = 57,
- Bip01_R_Thigh = 58,
- Bip01_R_Calf = 59,
- Bip01_R_Foot = 60,
- Bip01_R_Toe0 = 61
- };
- void GetAngleToTargetByScreen(const D3DXVECTOR2& ScreenSpace, D3DXVECTOR2& anglesOut)
- {
- D3DXVECTOR2 centerScreen(TelaX * 0.5f, (TelaY * 0.5f) + 10);
- D3DXVECTOR2 centerScreen_Normalized = centerScreen;
- D3DXVECTOR2 bottomRight(ScreenSpace.x, centerScreen.y);
- D3DXVec2Normalize(¢erScreen_Normalized, ¢erScreen_Normalized);
- D3DXVec2Normalize(&bottomRight, &bottomRight);
- float rightDotProduct = D3DXVec2Dot(¢erScreen_Normalized, &bottomRight);
- bool xDirection = D3DXToDegree(atan2f(bottomRight.y - centerScreen_Normalized.y, bottomRight.x - centerScreen_Normalized.x)) < 0.0f;
- float yawToTurn = D3DXToDegree(acos(min(rightDotProduct, 1.0f)));
- D3DXVECTOR2 topLeft(centerScreen.x, ScreenSpace.y);
- D3DXVec2Normalize(&topLeft, &topLeft);
- float upDotProduct = D3DXVec2Dot(¢erScreen_Normalized, &topLeft);
- bool yDirection = D3DXToDegree(atan2f(topLeft.y - centerScreen_Normalized.y, topLeft.x - centerScreen_Normalized.x)) < 0.0f;
- float pitchToTurn = D3DXToDegree(acos(min(upDotProduct, 1.0f)));
- if (yawToTurn != yawToTurn)
- yawToTurn = 0.0f;
- if (pitchToTurn != pitchToTurn)
- pitchToTurn = 0.0f;
- if (fabs(yawToTurn) <= 0.02f)
- yawToTurn = 0.0f;
- if (fabs(pitchToTurn) <= 0.02f)
- pitchToTurn = 0.0f;
- if (xDirection)
- anglesOut.x = -yawToTurn;
- else
- anglesOut.x = yawToTurn;
- if (yDirection)
- anglesOut.y = pitchToTurn;
- else
- anglesOut.y = -pitchToTurn;
- }
- float DistanceBetweenCross(D3DXVECTOR3 Head)
- {
- float ydist = (Head.y - TelaX / 2);
- float xdist = (Head.x - TelaY / 2);
- float Hypotenuse = sqrt(pow(ydist, 2) + pow(xdist, 2));
- return Hypotenuse;
- }
- void GetClosestPlayerToCrossHair(DWORD Player, D3DXVECTOR3 Head, float &max)
- {
- if (!GetAsyncKeyState(VK_RBUTTON)) //Dont change target while aiming
- {
- if (Player)
- {
- float Dist = DistanceBetweenCross(Head);
- if (Dist < max)
- {
- max = Dist;
- PlayertoAim = Player;
- }
- }
- }
- }
- void AimAt(DWORD Player)
- {
- DWORD LocalPlayerAddress;
- D3DXVECTOR3 LocalPlayerPos;
- LocalPlayerAddress = memory.read<DWORD>(GetGame() + LocalPlayerOffset);
- LocalPlayerAddress ^= LocalPlayerXOR;
- LocalPlayerPos = memory.read<D3DXVECTOR3 >(LocalPlayerAddress + locationAddress);
- if (Player)
- {
- D3DXVECTOR2 vAngles;
- D3DXVECTOR3 doneHeads = GetBoneOrigin(Player, Bip01_Head);
- D3DXVECTOR3 doneHead;
- if (World2Screen(doneHeads, &doneHead) && (doneHead.y != 0 || doneHead.x != 0))
- {
- GetAngleToTargetByScreen(D3DXVECTOR2(doneHead.x, doneHead.y - (getDistance(LocalPlayerPos, doneHeads) * 0.05f)), vAngles);
- float OldYaw = memory.read<float>(LocalPlayerAddress + 0x13B4);
- float OldPitch = memory.read<float>(LocalPlayerAddress + 0x13B8);
- isaimbotting = true;
- memory.write<float>(LocalPlayerAddress + 0x13B4, OldYaw + vAngles.x);
- memory.write<float>(LocalPlayerAddress + 0x13B8, OldPitch + vAngles.y);
- }
- }
- }
- void Aimbot()
- {
- if ((PlayertoAim != 0))
- {
- if (GetAsyncKeyState(VK_RBUTTON))
- {
- AimAt(PlayertoAim);
- }
- else
- {
- isaimbotting = false;
- }
- }
- }
- void drawnplayer(){
- float health = memory.read<float>(objAddress + (DWORD)0x04B4); //Make sure you use right offset to health.
- if (health > 0) //make sure he is alive
- {
- GetClosestPlayerToCrossHair(objAddress, doneHead, max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement