Advertisement
akaMeltDown

lol

Sep 4th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.08 KB | None | 0 0
  1. //no compiled headers & use Multi Byte
  2. #include <Windows.h>
  3. DWORD gameModule;
  4. DWORD localPlayer;
  5. DWORD localPlayerAddy = 0xCF1A4C;
  6. DWORD vectorOrigin = 0x138;
  7. DWORD entityList = 0x4D03AA4;
  8. DWORD viewMatrix = 0x4CF54D4;
  9. DWORD boneMatrix = 0x26A8;
  10. DWORD dormat = 0xED;
  11. DWORD team = 0xF4;
  12. DWORD healthOffset = 0x100;
  13. HWND hwndCSGO;
  14. HBRUSH Brush;
  15. HDC hdcCSGO;
  16.  
  17. float Matrix[16];
  18.  
  19. //defining our vectors
  20. struct Vec3
  21. {
  22. float x, y, z;
  23. };
  24.  
  25. struct Vec4
  26. {
  27. float x, y, z, w;
  28. };
  29.  
  30. struct Vec2
  31. {
  32. float x, y;
  33. };
  34.  
  35. //These two function are from a old fleep post, i was able to use them to create the box style however this was just to save time :) Thx Fleep
  36. void DrawFilledRect(int x, int y, int w, int h)
  37. {
  38. RECT rect = { x, y, x + w, y + h };
  39. FillRect(hdcCSGO, &rect, Brush);
  40. }
  41.  
  42.  
  43. void DrawBorderBox(int x, int y, int w, int h, int thickness)
  44. {
  45.  
  46. DrawFilledRect(x, y, w, thickness);
  47.  
  48. DrawFilledRect(x, y, thickness, h);
  49.  
  50. DrawFilledRect((x + w), y, thickness, h);
  51.  
  52. DrawFilledRect(x, y + h, w + thickness, thickness);
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59. //this is the world to screen function for directX
  60. bool WorldToScreen(Vec3 pos, Vec2 &screen, float matrix[16], int windowWidth, int windowHeight)
  61. {
  62. Vec4 clipCoords;
  63. clipCoords.x = pos.x*matrix[0] + pos.y*matrix[1] + pos.z*matrix[2] + matrix[3];
  64. clipCoords.y = pos.x*matrix[4] + pos.y*matrix[5] + pos.z*matrix[6] + matrix[7];
  65. clipCoords.z = pos.x*matrix[8] + pos.y*matrix[9] + pos.z*matrix[10] + matrix[11];
  66. clipCoords.w = pos.x*matrix[12] + pos.y*matrix[13] + pos.z*matrix[14] + matrix[15];
  67.  
  68. if (clipCoords.w < 0.1f)
  69. return false;
  70.  
  71.  
  72. Vec3 NDC;
  73. NDC.x = clipCoords.x / clipCoords.w;
  74. NDC.y = clipCoords.y / clipCoords.w;
  75. NDC.z = clipCoords.z / clipCoords.w;
  76.  
  77. screen.x = (windowWidth / 2 * NDC.x) + (NDC.x + windowWidth / 2);
  78. screen.y = -(windowHeight / 2 * NDC.y) + (NDC.y + windowHeight / 2);
  79. return true;
  80. }
  81.  
  82. int mainThread()
  83. {
  84. gameModule = (DWORD)GetModuleHandle("client.dll");//creates the game module
  85. hwndCSGO = FindWindow(0, ("Counter-Strike: Global Offensive"));//Gets Window
  86.  
  87. while (true)
  88. {
  89. //Base of player
  90. Vec2 vScreen;
  91. //Head of player
  92. Vec2 vHead;
  93.  
  94. memcpy(&Matrix, (PBYTE*)(gameModule + viewMatrix), sizeof(Matrix));
  95.  
  96. localPlayer = *(DWORD*)(gameModule + localPlayerAddy);//Creates your local player
  97.  
  98. if (localPlayer == NULL)//checks if your local player is existant
  99. {
  100.  
  101. while (localPlayer == NULL)
  102. {
  103. localPlayer = *(DWORD*)(gameModule + localPlayerAddy);
  104. }
  105.  
  106. }
  107.  
  108. hdcCSGO = GetDC(hwndCSGO);
  109.  
  110. int myTeam = *(int*)(localPlayer + team);
  111.  
  112. //our entity list loop
  113. for (short int i = 0; i < 64; i++)
  114. {
  115. //each entity is 0x10 apart in memory
  116. DWORD entity = *(DWORD*)(gameModule + entityList + i * 0x10);
  117.  
  118.  
  119.  
  120. if (entity != NULL)
  121. {
  122. if (entity != localPlayer)//Makes sure we dont draw on our own player
  123. {
  124. int entityTeam = *(int*)(entity + team);
  125.  
  126. Vec3 entityLocation = *(Vec3*)(entity + vectorOrigin);
  127.  
  128. DWORD dwBoneMatrix = *(DWORD*)(entity + boneMatrix);
  129.  
  130. DWORD health = *(DWORD*)(entity + healthOffset);
  131. int isDormat = *(int*)(entity + dormat);
  132.  
  133. if (isDormat == 0)//Checks if the entity is culled
  134. {
  135. if (health > 0)
  136. {
  137. if (WorldToScreen(entityLocation, vScreen, Matrix, 1920, 1080))
  138. {
  139. //this gets the x,y,z of the head bone
  140. float enemyHeadX = *(float*)(dwBoneMatrix + 0x30 * 9 + 0x0C);
  141. float enemyHeadY = *(float*)(dwBoneMatrix + 0x30 * 9 + 0x1C);
  142. float enemyHeadZ = *(float*)(dwBoneMatrix + 0x30 * 9 + 0x2C);
  143. //turns the head bone floats into a Vec3
  144. Vec3 enemyHeadPos = { enemyHeadX, enemyHeadY, enemyHeadZ };
  145.  
  146. //this takes the entitys cords and the players view matrix turning them into screen cords
  147. if (WorldToScreen(enemyHeadPos, vHead, Matrix, 1920, 1080))
  148. {
  149. float head = vHead.y - vScreen.y;
  150. float width = head / 2;
  151. float center = width / -2;
  152.  
  153.  
  154. if (myTeam == entityTeam)
  155. {
  156. Brush = CreateSolidBrush(RGB(000, 000, 255));//Any color you want
  157. DrawBorderBox(vScreen.x + center, vScreen.y, width, head - 5, 2);//Draws the boxes
  158. DeleteObject(Brush);
  159. }
  160. else
  161. {
  162. Brush = CreateSolidBrush(RGB(255, 000, 000));
  163. DrawBorderBox(vScreen.x + center, vScreen.y, width, head - 5, 2);
  164. DeleteObject(Brush);
  165. }
  166. }
  167.  
  168.  
  169. }
  170. }
  171. }
  172. }
  173. }
  174. }
  175. //This prevents a fat memory leak
  176. Sleep(1);
  177. DeleteObject(hdcCSGO);
  178.  
  179. }
  180. }
  181.  
  182. BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
  183. {
  184. if (dwReason == DLL_PROCESS_ATTACH) {
  185. DisableThreadLibraryCalls(hModule);
  186. CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)mainThread, NULL, NULL, NULL);
  187.  
  188. }
  189.  
  190. return TRUE;
  191. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement