Advertisement
Guest User

Untitled

a guest
Nov 28th, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.47 KB | None | 0 0
  1. #include <d3d9.h>
  2. #include <d3dx9.h>
  3. #include <stdio.h>
  4. #include <iostream>
  5. #include <string>
  6. #include <windows.h>
  7.  
  8. class CDeathPlayer;
  9. class CLocalPlayerID;
  10. class CRenderData;
  11. class CRenderContext;
  12. class CGameBase;
  13. class CBonesContext;
  14. class CBone;
  15. class CDeathPlayer
  16. {
  17. public:
  18. BYTE Death[16];
  19. };
  20.  
  21. class CLocalPlayerID
  22. {
  23. public:
  24. BYTE ID;
  25. };
  26.  
  27. class CRenderData
  28. {
  29. public:
  30. CRenderContext* RenderData;
  31. };
  32.  
  33. class CRenderContext
  34. {
  35. public:
  36.  
  37. char unknown[0x8BF];
  38. D3DXMATRIX ViewMatrix;
  39. D3DXMATRIX ProjectMatrix;
  40. D3DXMATRIX WorldMatrix;
  41. };
  42.  
  43. class CGameBase
  44. {
  45. public:
  46. char pad[0x158];
  47. CBonesContext* Bones;
  48. };
  49.  
  50. class CBonesContext
  51. {
  52. public:
  53. char pad[0xE8];
  54. CBone* BoneData;
  55. };
  56.  
  57. class CBone
  58. {
  59. public:
  60. D3DXMATRIX BoneMatrix;
  61. };
  62.  
  63. class CGame
  64. {
  65. public:
  66. BYTE unknown1[0x14];
  67. CGameBase *GameBase[16];
  68. };
  69.  
  70. DWORD d;
  71. //=======================================================================
  72. //-----------------------------------------------------------------
  73. //"void __thiscall CGameContext::setUserDe"...
  74. //-----------------------------------------------------------------
  75. BYTE GetUserLife(int iSlot)//Saber se o Player esta vivo...
  76. {
  77. DWORD g_pGameContext = *(DWORD*)0xAFBEC0; //"bool __thiscall CGameCharaBase::NET_Hit"...
  78. CDeathPlayer *Life = (CDeathPlayer *) (g_pGameContext + 0x2AD08);
  79. return Life->Death[iSlot];
  80. VirtualProtect((PVOID*)(g_pGameContext+0x2AD08), 10, PAGE_EXECUTE_READWRITE, &d);
  81. }
  82. //Fim__
  83.  
  84.  
  85. //------------------------------------------------------------------
  86. //"void __thiscall CGameContext::setMySlot"...
  87. //------------------------------------------------------------------
  88. int GetCharaIndex()//Obter Meu Slot.
  89. {
  90. DWORD g_pGameContext = *(DWORD*)0xAFBEC0; //"bool __thiscall CGameCharaBase::NET_Hit"...
  91. CLocalPlayerID *LocID = (CLocalPlayerID *) (g_pGameContext + 0x2ACB8);
  92. return LocID->ID;
  93. VirtualProtect((PVOID*)(g_pGameContext+0x2ACB8), 10, PAGE_EXECUTE_READWRITE, &d);
  94. }
  95. //Fim__
  96.  
  97.  
  98. //------------------------------------------------------------------
  99. //MyPosition-EnemyPosition...
  100. //------------------------------------------------------------------
  101. float CalcDistance(D3DXVECTOR3 VecA, D3DXVECTOR3 VecB)//Calcular distancia.
  102. {
  103. return sqrt( (( VecA.x - VecB.x) * ( VecA.x - VecB.x)) +
  104. (( VecA.y - VecB.y) * ( VecA.y - VecB.y)) +
  105. (( VecA.z - VecB.z) * ( VecA.z - VecB.z)));
  106. }
  107. //Fim__
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. //-----------------------------------------------------------------
  115. //"int __thiscall CGameCharaBoneContext::g"...
  116. //-----------------------------------------------------------------
  117. bool GetUserBone(D3DXVECTOR3 &Out, int index, int BoneIndex)//Obter Ossos.
  118. {
  119. DWORD g_pCharaManager = *(DWORD*)0xAFBE8C; //ou 0xAFBE90 //"void __thiscall CStageBattle::_SetDefau"...
  120. if(g_pCharaManager)
  121. {
  122. CGameBase* GameBase = (CGameBase*) (*(DWORD*)(g_pCharaManager + 0x14 + (0x4 * index) ));
  123. VirtualProtect((PVOID*)(g_pCharaManager + 0x14 + (0x4 * index) ), 10, PAGE_EXECUTE_READWRITE, &d);
  124. if (GameBase && GameBase->Bones)
  125. {
  126. Out.x = GameBase->Bones->BoneData[BoneIndex].BoneMatrix._41;
  127. Out.y = GameBase->Bones->BoneData[BoneIndex].BoneMatrix._42;
  128. Out.z = GameBase->Bones->BoneData[BoneIndex].BoneMatrix._43;
  129. return true;
  130. }
  131. }
  132. return false;
  133. }
  134. //Fim__
  135.  
  136.  
  137. void *DetourCreate(BYTE *src, const BYTE *dst, const int len)
  138. {
  139. BYTE *jmp;
  140. DWORD dwback;
  141. DWORD jumpto, newjump;
  142.  
  143. VirtualProtect(src,len,PAGE_READWRITE,&dwback);
  144.  
  145. if(src[0] == 0xE9)
  146. {
  147. jmp = (BYTE*)malloc(10);
  148. jumpto = (*(DWORD*)(src+1))+((DWORD)src)+5;
  149. newjump = (jumpto-(DWORD)(jmp+5));
  150. jmp[0] = 0xE9;
  151. *(DWORD*)(jmp+1) = newjump;
  152. jmp += 5;
  153. jmp[0] = 0xE9;
  154. *(DWORD*)(jmp+1) = (DWORD)(src-jmp);
  155. }
  156. else
  157. {
  158. jmp = (BYTE*)malloc(5+len);
  159. memcpy(jmp,src,len);
  160. jmp += len;
  161. jmp[0] = 0xE9;
  162. *(DWORD*)(jmp+1) = (DWORD)(src+len-jmp)-5;
  163. }
  164. src[0] = 0xE9;
  165. *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
  166.  
  167. for(int i = 5; i < len; i++)
  168. src[i] = 0x90;
  169.  
  170. VirtualProtect(src,len,dwback,&dwback);
  171. return (jmp-len);
  172. }
  173.  
  174.  
  175. //-------------------------------------------------------------------
  176. //Verifica de o player esta a < de 100.0f...
  177. //-------------------------------------------------------------------
  178. int GetPriorityTarget()//Pega a posição do player mais próximo.
  179. {
  180. int Result = -1;
  181. float fMaxDistance = 100.0f;
  182. D3DXVECTOR3 PlayerEnd, LocPlayer;
  183.  
  184. for (int index = 0; index < 16; index++)
  185. {
  186. if (!GetUserLife(index) && GetCharaIndex() != index)
  187. {
  188. if (GetCharaIndex() %2 != index % 2)
  189. {
  190. GetUserBone(LocPlayer, GetCharaIndex(), 7);
  191. GetUserBone(PlayerEnd, index, 7);
  192. if (CalcDistance(LocPlayer, PlayerEnd) < fMaxDistance)
  193. {
  194.  
  195. fMaxDistance = CalcDistance(PlayerEnd, LocPlayer);
  196. Result = index;
  197.  
  198. }
  199. }
  200. }
  201. }
  202. return Result;
  203. }
  204. //Fim__
  205.  
  206.  
  207.  
  208. //-----------------------------------------------------------------
  209. //"void __thiscall WeaponBase::DoLineColli"...
  210. //-----------------------------------------------------------------
  211. DWORD dwEnd = 0x4E2B3D;
  212. DWORD dwReturnEnd = dwEnd + 7;
  213. float fX = 10.0f, fY = 10.0f, fZ = 10.0f;
  214. bool EndEnable;
  215. DWORD dwTempEcx, dwTempEbx;
  216. _declspec( naked ) void End( )
  217. {
  218. if ( EndEnable )
  219. {
  220. _asm
  221. {
  222. mov [dwTempEcx], ecx;
  223. mov [dwTempEbx], ebx;
  224.  
  225. mov ecx, [ebp+0x0C];
  226.  
  227. mov ebx, [fX];
  228. mov [ecx], ebx;
  229.  
  230. mov ebx, [fY];
  231. mov [ecx+0x04], ebx;
  232.  
  233. mov ebx, [fZ];
  234. mov [ecx+0x08], ebx;
  235.  
  236. mov ecx, [dwTempEcx];
  237. mov ebx, [dwTempEbx];
  238. }
  239. }
  240.  
  241. _asm
  242. {
  243. mov eax, [ebp+0x08];
  244. push eax;
  245. mov ecx, [ebp-0x38];
  246.  
  247. jmp dwReturnEnd;
  248. }
  249. }
  250. //Fim__
  251.  
  252. //-------------------------------------------------------------
  253. //--------------------------AIMBOT-----------------------------
  254. //-------------------------------------------------------------
  255. void AimBot()
  256. {
  257. DWORD g_pPlayer = *(DWORD*)0xAAFAE88; //"int __thiscall CGameCharaBase::OnHit(st"...
  258. if(g_pPlayer != 0x0000)
  259. {
  260. int Priority = GetPriorityTarget();
  261. if(Priority != -1)
  262. {
  263. EndEnable = true;
  264. D3DXVECTOR3 OnScreen, OnWorld;
  265. D3DXVECTOR3 Out, Screen;
  266. GetUserBone(Out, Priority, 7);
  267. fX = Out.x;
  268. fY = Out.y;
  269. fZ = Out.z;
  270. DetourCreate((PBYTE)dwEnd, (PBYTE)End, 7);
  271. VirtualProtect((PVOID*)(dwEnd), 10, PAGE_EXECUTE_READWRITE, &d);
  272. VirtualProtect((PVOID*)(dwReturnEnd), 10, PAGE_EXECUTE_READWRITE, &d);
  273. VirtualProtect((PVOID*)(g_pPlayer), 10, PAGE_EXECUTE_READWRITE, &d);
  274.  
  275. }
  276.  
  277. }
  278.  
  279.  
  280. else
  281. {
  282. EndEnable = false;
  283. DetourCreate((PBYTE)dwEnd, (PBYTE)End, 7);
  284. }
  285. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement