Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. DWORD PlayertoAim = 0; //Our player adress
  2. bool isaimbotting = false; //Can be useful
  3.  
  4. enum E_Bones // 62
  5. {
  6. Bip01 = 0,
  7. Bip01_Pelvis = 1,
  8. Bip01_Spine = 2,
  9. Bip01_Spine1 = 3,
  10. Bip01_Spine2 = 4,
  11. Bip01_Neck = 5,
  12. Bip01_Head = 6,
  13. Bip01_L_Clavicle = 7,
  14. Bip01_L_UpperArm = 8,
  15. Bip01_L_Forearm = 9,
  16. Bip01_L_Hand = 10,
  17. Bip01_L_Finger0 = 11,
  18. Bip01_L_Finger01 = 12,
  19. Bip01_L_Finger02 = 13,
  20. Bip01_L_Finger1 = 14,
  21. Bip01_L_Finger11 = 15,
  22. Bip01_L_Finger12 = 16,
  23. Bip01_L_Finger2 = 17,
  24. Bip01_L_Finger21 = 18,
  25. Bip01_L_Finger22 = 19,
  26. Bip01_L_Finger3 = 20,
  27. Bip01_L_Finger31 = 21,
  28. Bip01_L_Finger32 = 22,
  29. Bip01_L_Finger4 = 23,
  30. Bip01_L_Finger41 = 24,
  31. Bip01_L_Finger42 = 25,
  32. Bip01_L_ForeTwist = 26,
  33. Bip01_L_ForeTwist1 = 27,
  34. Bip01_R_Clavicle = 28,
  35. Bip01_R_UpperArm = 29,
  36. Bip01_R_Forearm = 30,
  37. Bip01_R_Hand = 31,
  38. Bip01_R_Finger0 = 32,
  39. Bip01_R_Finger01 = 33,
  40. Bip01_R_Finger02 = 34,
  41. Bip01_R_Finger1 = 35,
  42. Bip01_R_Finger11 = 36,
  43. Bip01_R_Finger12 = 37,
  44. Bip01_R_Finger2 = 38,
  45. Bip01_R_Finger21 = 39,
  46. Bip01_R_Finger22 = 40,
  47. Bip01_R_Finger3 = 41,
  48. Bip01_R_Finger31 = 42,
  49. Bip01_R_Finger32 = 43,
  50. Bip01_R_Finger4 = 44,
  51. Bip01_R_Finger41 = 45,
  52. Bip01_R_Finger42 = 46,
  53. PrimaryWeaponBone = 47,
  54. Bip01_R_ForeTwist = 48,
  55. Bip01_R_ForeTwist1 = 49,
  56. Weapon_BackLeft = 50,
  57. Weapon_BackRPG = 51,
  58. Weapon_BackRight = 52,
  59. Bip01_L_Thigh = 53,
  60. Bip01_L_Calf = 54,
  61. Bip01_L_Foot = 55,
  62. Bip01_L_Toe0 = 56,
  63. Weapon_Side = 57,
  64. Bip01_R_Thigh = 58,
  65. Bip01_R_Calf = 59,
  66. Bip01_R_Foot = 60,
  67. Bip01_R_Toe0 = 61
  68. };
  69. void GetAngleToTargetByScreen(const D3DXVECTOR2& ScreenSpace, D3DXVECTOR2& anglesOut)
  70. {
  71. D3DXVECTOR2 centerScreen(TelaX * 0.5f, (TelaY * 0.5f) + 10);
  72. D3DXVECTOR2 centerScreen_Normalized = centerScreen;
  73. D3DXVECTOR2 bottomRight(ScreenSpace.x, centerScreen.y);
  74. D3DXVec2Normalize(&centerScreen_Normalized, &centerScreen_Normalized);
  75. D3DXVec2Normalize(&bottomRight, &bottomRight);
  76.  
  77. float rightDotProduct = D3DXVec2Dot(&centerScreen_Normalized, &bottomRight);
  78. bool xDirection = D3DXToDegree(atan2f(bottomRight.y - centerScreen_Normalized.y, bottomRight.x - centerScreen_Normalized.x)) < 0.0f;
  79. float yawToTurn = D3DXToDegree(acos(min(rightDotProduct, 1.0f)));
  80.  
  81. D3DXVECTOR2 topLeft(centerScreen.x, ScreenSpace.y);
  82. D3DXVec2Normalize(&topLeft, &topLeft);
  83. float upDotProduct = D3DXVec2Dot(&centerScreen_Normalized, &topLeft);
  84. bool yDirection = D3DXToDegree(atan2f(topLeft.y - centerScreen_Normalized.y, topLeft.x - centerScreen_Normalized.x)) < 0.0f;
  85. float pitchToTurn = D3DXToDegree(acos(min(upDotProduct, 1.0f)));
  86.  
  87. if (yawToTurn != yawToTurn)
  88. yawToTurn = 0.0f;
  89.  
  90. if (pitchToTurn != pitchToTurn)
  91. pitchToTurn = 0.0f;
  92.  
  93. if (fabs(yawToTurn) <= 0.02f)
  94. yawToTurn = 0.0f;
  95.  
  96. if (fabs(pitchToTurn) <= 0.02f)
  97. pitchToTurn = 0.0f;
  98.  
  99. if (xDirection)
  100. anglesOut.x = -yawToTurn;
  101. else
  102. anglesOut.x = yawToTurn;
  103.  
  104. if (yDirection)
  105. anglesOut.y = pitchToTurn;
  106. else
  107. anglesOut.y = -pitchToTurn;
  108. }
  109. float DistanceBetweenCross(D3DXVECTOR3 Head)
  110. {
  111. float ydist = (Head.y - TelaX / 2);
  112. float xdist = (Head.x - TelaY / 2);
  113. float Hypotenuse = sqrt(pow(ydist, 2) + pow(xdist, 2));
  114. return Hypotenuse;
  115. }
  116.  
  117. void GetClosestPlayerToCrossHair(DWORD Player, D3DXVECTOR3 Head, float &max)
  118. {
  119. if (!GetAsyncKeyState(VK_RBUTTON)) //Dont change target while aiming
  120. {
  121. if (Player)
  122. {
  123. float Dist = DistanceBetweenCross(Head);
  124. if (Dist < max)
  125. {
  126. max = Dist;
  127. PlayertoAim = Player;
  128. }
  129. }
  130. }
  131.  
  132. }
  133. void AimAt(DWORD Player)
  134. {
  135. DWORD LocalPlayerAddress;
  136. D3DXVECTOR3 LocalPlayerPos;
  137. LocalPlayerAddress = memory.read<DWORD>(GetGame() + LocalPlayerOffset);
  138. LocalPlayerAddress ^= LocalPlayerXOR;
  139. LocalPlayerPos = memory.read<D3DXVECTOR3 >(LocalPlayerAddress + locationAddress);
  140. if (Player)
  141. {
  142. D3DXVECTOR2 vAngles;
  143. D3DXVECTOR3 doneHeads = GetBoneOrigin(Player, Bip01_Head);
  144. D3DXVECTOR3 doneHead;
  145.  
  146. if (World2Screen(doneHeads, &doneHead) && (doneHead.y != 0 || doneHead.x != 0))
  147. {
  148. GetAngleToTargetByScreen(D3DXVECTOR2(doneHead.x, doneHead.y - (getDistance(LocalPlayerPos, doneHeads) * 0.05f)), vAngles);
  149. float OldYaw = memory.read<float>(LocalPlayerAddress + 0x13B4);
  150. float OldPitch = memory.read<float>(LocalPlayerAddress + 0x13B8);
  151.  
  152. isaimbotting = true;
  153. memory.write<float>(LocalPlayerAddress + 0x13B4, OldYaw + vAngles.x);
  154. memory.write<float>(LocalPlayerAddress + 0x13B8, OldPitch + vAngles.y);
  155. }
  156. }
  157.  
  158. }
  159. void Aimbot()
  160. {
  161. if ((PlayertoAim != 0))
  162. {
  163. if (GetAsyncKeyState(VK_RBUTTON))
  164. {
  165. AimAt(PlayertoAim);
  166. }
  167. else
  168. {
  169. isaimbotting = false;
  170. }
  171. }
  172. }
  173.  
  174. void drawnplayer(){
  175. float health = memory.read<float>(objAddress + (DWORD)0x04B4); //Make sure you use right offset to health.
  176. if (health > 0) //make sure he is alive
  177. {
  178. GetClosestPlayerToCrossHair(objAddress, doneHead, max);
  179. }
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement