Advertisement
BaSs_HaXoR

BO2 Aimbot Source 1.18 (C#)

Jul 22nd, 2014
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.04 KB | None | 0 0
  1. class Offsets
  2. {
  3. public static uint
  4.  
  5. //G_Client
  6. G_Client = 0x1780F28,
  7. G_ClientSize = 0x5808,
  8. ClientOrigin = 0x28,
  9. ClientAngles = 0x56BC,
  10. ClientTeam = 0x5504,
  11. ClientIsAlive = 0x55D0,
  12. ClientStance = 0xFC,
  13.  
  14. //Entity
  15. G_Entity = 0x16B9F20,
  16. G_EntitySize = 0x31C,
  17. SetClientViewAngles = 0x1E1D90;
  18.  
  19.  
  20. public class Funcs
  21. {
  22. public static float[] getPlayerPosition(int clientIndex)
  23. {
  24. float[] Position = Lib.ReadSingle(Offsets.Funcs.G_Client(clientIndex, Offsets.ClientOrigin), 3);
  25. return Position;
  26. }
  27. public static uint G_Client(int clientIndex, uint Mod = 0x00)
  28. {
  29. return (Offsets.G_Client + (UInt32)Mod) + ((uint)clientIndex * 0x5808);
  30. }
  31. public static uint G_Entity(int entityIndex, uint Mod = 0x00)
  32. {
  33. return (Offsets.G_Entity + (UInt32)Mod) + ((uint)entityIndex * 0x31C);
  34. }
  35. }
  36. }
  37.  
  38. public static bool ClientIsSameTeam(int clientIndex, int otherPlayer)
  39. {
  40. return (Lib.ReadInt32(Offsets.Funcs.G_Client(clientIndex, Offsets.ClientTeam)) == Lib.ReadInt32(Offsets.Funcs.G_Client(otherPlayer, Offsets.ClientTeam)));
  41. }
  42. public static bool ClientIsInGame(int clientIndex)
  43. {
  44. return (Lib.ReadInt32(Offsets.Funcs.G_Client(clientIndex, 0x00)) != 0);
  45. }
  46. public static bool ClientIsAlive(int clientIndex)
  47. {
  48. return (Lib.ReadInt32(Offsets.Funcs.G_Client(clientIndex, Offsets.ClientIsAlive)) == 0);
  49. }
  50. public static float[] vectoangles(float[] Angles)
  51. {
  52. float forward;
  53. float yaw, pitch;
  54. float[] angles = new float[3];
  55. if (Angles[1] == 0 && Angles[0] == 0)
  56. {
  57. yaw = 0;
  58. if (Angles[2] > 0) pitch = 90f;
  59. else pitch = 270f;
  60. }
  61. else
  62. {
  63. if (Angles[0] != -1) yaw = (float)(Math.Atan2((double)Angles[1], (double)Angles[0]) * 180f / Math.PI);
  64. else if (Angles[1] > 0) yaw = 90f;
  65. else yaw = 270;
  66. if (yaw < 0) yaw += 360f;
  67.  
  68. forward = (float)Math.Sqrt((double)(Angles[0] * Angles[0] + Angles[1] * Angles[1]));
  69. pitch = (float)(Math.Atan2((double)Angles[2], (double)forward) * 180f / Math.PI);
  70. if (pitch < 0) pitch += 360f;
  71. }
  72. angles[0] = -pitch;
  73. angles[1] = yaw;
  74. angles[2] = 0;
  75.  
  76. return angles;
  77. }
  78. public static float[] getVector(float[] point1, float[] point2)
  79. {
  80. return new float[] { (point2[0] - point1[0]), (point2[1] - point1[1]), (point2[2] - point1[2]) };
  81. }
  82. public static float Distance3D(float[] point1, float[] point2)
  83. {
  84. float deltax = point2[0] - point1[0];
  85. float deltay = point2[1] - point1[1];
  86. float deltaz = point2[2] - point1[2];
  87. return Convert.ToSingle(Math.Sqrt((deltax * deltax) + (deltay * deltay) + (deltaz * deltaz)));
  88. }
  89. public static float Distance2D(float[] point1, float[] point2)
  90. {
  91. float deltax = point2[0] - point1[0];
  92. float deltaz = point2[1] - point1[1];
  93. return Convert.ToSingle(Math.Sqrt((deltax * deltax) + (deltaz * deltaz)));
  94. }
  95. public static int GetNearestPlayer(int clientIndex)
  96. {
  97. int nearestClient = 0;
  98. float nearestDistance = 99999999;
  99. for (int i = 0; i < MenuBase.MaxClients; i++)
  100. {
  101. if (i != clientIndex)
  102. {
  103. if ((ClientIsInGame(i)) && ClientIsAlive(i))
  104. {
  105. if (Lib.ReadInt32(Offsets.Funcs.G_Client(clientIndex, Offsets.ClientTeam)) != 0)
  106. {
  107. if (!ClientIsSameTeam(clientIndex, i))
  108. {
  109. float Distance = Distance3D(Offsets.Funcs.getPlayerPosition(clientIndex), Offsets.Funcs.getPlayerPosition(i));
  110. if (Distance < nearestDistance)
  111. {
  112. nearestDistance = Distance;
  113. nearestClient = i;
  114. }
  115. }
  116. }
  117. else
  118. {
  119. float Distance = Distance3D(Offsets.Funcs.getPlayerPosition(clientIndex), Offsets.Funcs.getPlayerPosition(i));
  120. if (Distance < nearestDistance)
  121. {
  122. nearestDistance = Distance;
  123. nearestClient = i;
  124. }
  125. }
  126. }
  127. }
  128. }
  129. return nearestClient;
  130. }
  131.  
  132. private static float CheckStance(int clientIndex)
  133. {
  134. Int32 CurrentStance = Lib.ReadByte(Offsets.Funcs.G_Client(clientIndex, Offsets.ClientStance + 0x03));
  135. if (CurrentStance == 0x08 || CurrentStance == 0x0A || CurrentStance == 0x48 || CurrentStance == 0x4A)
  136. { return 44f; }
  137. if (CurrentStance == 0x04 || CurrentStance == 0x06 || CurrentStance == 0x44 || CurrentStance == 0x46)
  138. { return 14f; }
  139. return 0f;
  140. }
  141. private static float CheckStanceAttacker(int clientIndex)
  142. {
  143. Int32 CurrentStance = Lib.ReadByte(Offsets.Funcs.G_Client(clientIndex, Offsets.ClientStance + 0x03));
  144. if (CurrentStance == 0x08 || CurrentStance == 0x0A || CurrentStance == 0x48 || CurrentStance == 0x4A)
  145. { return 46f; }
  146. if (CurrentStance == 0x04 || CurrentStance == 0x06 || CurrentStance == 0x44 || CurrentStance == 0x46)
  147. { return 18f; }
  148. return 0f;
  149. }
  150.  
  151. private static void SetClientViewAngles(int clientIndex, int Victim)
  152. {
  153. float[] Vec = getVector(Offsets.Funcs.getPlayerPosition(clientIndex), Offsets.Funcs.getPlayerPosition(Victim));
  154. Vec[2] -= CheckStance(Victim);
  155. Vec[2] += CheckStanceAttacker(clientIndex);
  156. float[] Angles = vectoangles(Vec);
  157. setViewAngles((uint)clientIndex, Angles);
  158. }
  159. public static void setViewAngles(uint clientIndex, float[] Angles)
  160. {
  161. Lib.WriteSingle(0x10040000, Angles);
  162. RPC.Call(Offsets.SetClientViewAngles, Offsets.Funcs.G_Entity((int)clientIndex), 0x10040000);
  163. }
  164.  
  165.  
  166. //HOW TO USE:
  167.  
  168. while (true)
  169. {
  170. SetClientViewAngles(0, GetNearestPlayer(0)) //This will set aimbot to client 0
  171. }
  172.  
  173.  
  174. //CREDITS TO SHARK
  175. //http://www.nextgenupdate.com/forums/call-duty-black-ops-2-mods-cheats-guides/731025-fair-aimbot-c-1-18-a-4.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement