Advertisement
Guest User

1234 test

a guest
Jun 7th, 2015
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.06 KB | None | 0 0
  1. #include "Game.h"
  2.  
  3. PModule modEngine, modClient;
  4. PMemory mem;
  5. HANDLE TargetProcess;
  6. DWORD DwClient;
  7. DWORD DwEngine;
  8.  
  9. DWORD DwEntityList = 0x04A16BD4;
  10. DWORD DwEnginePointer = 0x005CE1C4;
  11. DWORD DwLocalPlayer = 0x00A74C9C;
  12. DWORD DwViewAngle = 0x00004CE0;
  13. DWORD dwSpotted = 0x935;
  14. DWORD dwjump = 0x04AA7930;
  15. DWORD offGlow = 0x04B29AB4;
  16. DWORD offEntityList = 0x04A16BD4;
  17. DWORD offLocalPlayer = 0x00A74C9C;
  18.  
  19. const DWORD DwCrosshairId = 0x2410;
  20. const DWORD DwVecViewOffset = 0x104;
  21. const DWORD DwVecOrigin = 0x134;
  22. const DWORD DwVecPunch = 0x13E8;
  23. const DWORD DwTeamNumber = 0xF0;
  24. const DWORD DwShotsFired = 0x1D6C;
  25. const DWORD DwFlags = 0x100;
  26. const DWORD DwBoneMatrix = 0xA78;
  27. const DWORD DwEntitySize = 0x10;
  28. const DWORD DwHealth = 0xFC;
  29. const DWORD DwLifeState = 0x25B;
  30. const DWORD DwVecVelocity = 0x110;
  31. const DWORD offEntityTeam = 0xF0;
  32.  
  33. float PitchMinPunch = 2.f;
  34. float PitchMaxPunch = 2.f;
  35. float YawMinPunch = 2.f;
  36. float YawMaxPunch = 2.f;
  37. float smoothamount = 20.f;
  38. int TargetBone = 10;
  39.  
  40. bool glowEnabled = true;
  41. bool aimEnabled = true;
  42. bool radarEnabled = true;
  43. bool trigEnabled = false;
  44. bool lockEnabled = false;
  45.  
  46. DWORD TrigVkeyCode;
  47. DWORD ForceAimVkeyCode;
  48. DWORD AutoAimVkeyCode;
  49. DWORD ESPVkeyCode;
  50. DWORD PanicVkeyCode;
  51. DWORD RadarVkeyCode;
  52. DWORD AimVkeyCode;
  53. DWORD NewAimVkeyCode = 1;
  54.  
  55.  
  56. [junk_enable / ]
  57. [enc_string_enable / ]
  58.  
  59.  
  60. struct
  61. {
  62. DWORD GetBaseEntity(int PlayerNumber)
  63. {
  64. return mem.Read<DWORD>(DwClient + DwEntityList + (DwEntitySize * PlayerNumber));
  65. }
  66.  
  67. bool IsDead(int PlayerNumber)
  68. {
  69. DWORD BaseEntity = GetBaseEntity(PlayerNumber);
  70. if (BaseEntity)
  71. {
  72. return mem.Read<bool>(BaseEntity + DwLifeState);
  73. }
  74. }
  75.  
  76. int GetTeam(int PlayerNumber)
  77. {
  78. DWORD BaseEntity = GetBaseEntity(PlayerNumber);
  79. if (BaseEntity)
  80. {
  81. return mem.Read<int>(BaseEntity + DwTeamNumber);
  82. }
  83. }
  84.  
  85. void GetVelocity(int PlayerNumber, float* Buffer)
  86. {
  87. DWORD BaseEntity = GetBaseEntity(PlayerNumber);
  88. if (BaseEntity)
  89. {
  90. mem.Read<float*>(BaseEntity + DwVecVelocity, true, 3, Buffer);
  91. }
  92. }
  93.  
  94. void GetBonePosition(int PlayerNumber, float* BonePosition)
  95. {
  96. DWORD BaseEntity = GetBaseEntity(PlayerNumber);
  97. if (BaseEntity)
  98. {
  99. DWORD BoneMatrix = mem.Read<DWORD>(BaseEntity + DwBoneMatrix);
  100. if (BoneMatrix)
  101. {
  102. mem.Read<float*>(BoneMatrix + 0x30 * TargetBone + 0x0C, true, 1, &BonePosition[0]);
  103. mem.Read<float*>(BoneMatrix + 0x30 * TargetBone + 0x1C, true, 1, &BonePosition[1]);
  104. mem.Read<float*>(BoneMatrix + 0x30 * TargetBone + 0x2C, true, 1, &BonePosition[2]);
  105. }
  106. }
  107. }
  108.  
  109. }EntityList;
  110.  
  111. struct
  112. {
  113.  
  114. DWORD GetPlayerBase()
  115. {
  116. return mem.Read<DWORD>(DwClient + DwLocalPlayer);
  117. }
  118.  
  119. void SetAngles(float* Angles)
  120. {
  121. DWORD AnglePointer = mem.Read<DWORD>(DwEngine + DwEnginePointer);
  122. if (AnglePointer)
  123. {
  124. mem.Write<float*>(AnglePointer + DwViewAngle, Angles, true, 3);
  125. }
  126. }
  127.  
  128. void GetVelocity(float* Buffer)
  129. {
  130. DWORD PlayerBase = GetPlayerBase();
  131. if (PlayerBase)
  132. {
  133. mem.Read<float*>(PlayerBase + DwVecVelocity, true, 3, Buffer);
  134. }
  135. }
  136.  
  137. void GetAngles(float* Angles)
  138. {
  139. DWORD AnglePointer = mem.Read<DWORD>(DwEngine + DwEnginePointer);
  140. if (AnglePointer)
  141. {
  142. mem.Read<float*>(AnglePointer + DwViewAngle, true, 3, Angles);
  143. }
  144. }
  145.  
  146. int GetTeam()
  147. {
  148. DWORD PlayerBase = GetPlayerBase();
  149. if (PlayerBase)
  150. {
  151. return mem.Read<int>(PlayerBase + DwTeamNumber);
  152. }
  153. }
  154.  
  155. int GetCrosshairId()
  156. {
  157. DWORD PlayerBase = GetPlayerBase();
  158. if (PlayerBase)
  159. {
  160. return mem.Read<int>(PlayerBase + DwCrosshairId) - 1;
  161. }
  162. }
  163.  
  164. void GetPunch(float* Punch)
  165. {
  166. DWORD PlayerBase = GetPlayerBase();
  167. if (PlayerBase)
  168. {
  169. mem.Read<float*>(PlayerBase + DwVecPunch, true, 2, Punch);
  170. }
  171. }
  172.  
  173. float GetViewOrigin()
  174. {
  175. DWORD PlayerBase = GetPlayerBase();
  176. if (PlayerBase)
  177. {
  178. float Vecview[3];
  179. mem.Read<float*>(PlayerBase + DwVecViewOffset, true, 3, Vecview);
  180. return Vecview[2];
  181. }
  182. }
  183.  
  184. void GetPosition(float* Position)
  185. {
  186. DWORD PlayerBase = GetPlayerBase();
  187. if (PlayerBase)
  188. {
  189. mem.Read<float*>(PlayerBase + DwVecOrigin, true, 3, Position);
  190. }
  191. }
  192.  
  193. int GetShotsFired()
  194. {
  195. DWORD PlayerBase = GetPlayerBase();
  196. if (PlayerBase)
  197. {
  198. return mem.Read<int>(PlayerBase + DwShotsFired);
  199. }
  200. }
  201.  
  202. }NewPlayer;
  203.  
  204.  
  205.  
  206. void AngleNormalize(float* angle)
  207. {
  208. if (angle[0] > 89.0f && angle[0] <= 180.0f)
  209. {
  210. angle[0] = 89.0f;
  211. }
  212. if (angle[0] > 180.f)
  213. {
  214. angle[0] -= 360.f;
  215. }
  216. if (angle[0] < -89.0f)
  217. {
  218. angle[0] = -89.0f;
  219. }
  220. if (angle[1] > 180.f)
  221. {
  222. angle[1] -= 360.f;
  223. }
  224. if (angle[1] < -180.f)
  225. {
  226. angle[1] += 360.f;
  227. }
  228. if (angle[2] != 0.0f)
  229. {
  230. angle[2] = 0.0f;
  231. }
  232. }
  233.  
  234. void calcang(float *src, float *dst, float *angles)
  235. {
  236. random_device Random;
  237. mt19937 RandomGen(Random());
  238. uniform_real<float> RandomXdistrib(PitchMinPunch, PitchMaxPunch);
  239. uniform_real<float> RandomYdistrib(YawMinPunch, YawMaxPunch);
  240. float MyPunch[2];
  241. NewPlayer.GetPunch(MyPunch);
  242. float pitchreduction = RandomXdistrib(RandomGen);
  243. float yawreduction = RandomYdistrib(RandomGen);
  244. float delta[3] = { (src[0] - dst[0]), (src[1] - dst[1]), ((src[2] + NewPlayer.GetViewOrigin()) - dst[2]) };
  245. float hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
  246. angles[0] = atanf(delta[2] / hyp) * 57.295779513082f - MyPunch[0] * pitchreduction;
  247. angles[1] = atanf(delta[1] / delta[0]) * 57.295779513082f - MyPunch[1] * yawreduction;
  248. angles[2] = 0.0f;
  249. if (delta[0] >= 0.0)
  250. {
  251. angles[1] += 180.0f;
  252. }
  253. }
  254.  
  255. void SmoothAngleSet(float* dest, float* orig)
  256. {
  257. float SmoothAngles[3];
  258. SmoothAngles[0] = dest[0] - orig[0];
  259. SmoothAngles[1] = dest[1] - orig[1];
  260. SmoothAngles[2] = 0.0f;
  261. AngleNormalize(SmoothAngles);
  262. SmoothAngles[0] = orig[0] + SmoothAngles[0] / 100.0f * smoothamount;
  263. SmoothAngles[1] = orig[1] + SmoothAngles[1] / 100.0f * smoothamount;
  264. SmoothAngles[2] = 0.0f;
  265. AngleNormalize(SmoothAngles);
  266. NewPlayer.SetAngles(SmoothAngles);
  267. Sleep(1);
  268. }
  269.  
  270. void Click()
  271. {
  272. mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
  273. Sleep(1);
  274. mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
  275. Sleep(30);
  276. }
  277.  
  278. void VelocityComp(int PlayerNumber, float* EnemyPos)
  279. {
  280. float EnemyVelocity[3];
  281. float MyVelocity[3];
  282. EntityList.GetVelocity(PlayerNumber, EnemyVelocity);
  283. NewPlayer.GetVelocity(MyVelocity);
  284. EnemyPos[0] = EnemyPos[0] + (EnemyVelocity[0] / 100.f) * (40.f / smoothamount);
  285. EnemyPos[1] = EnemyPos[1] + (EnemyVelocity[1] / 100.f) * (40.f / smoothamount);
  286. EnemyPos[2] = EnemyPos[2] + (EnemyVelocity[2] / 100.f) * (40.f / smoothamount);
  287. EnemyPos[0] = EnemyPos[0] - (MyVelocity[0] / 100.f) * (40.f / smoothamount);
  288. EnemyPos[1] = EnemyPos[1] - (MyVelocity[1] / 100.f) * (40.f / smoothamount);
  289. EnemyPos[2] = EnemyPos[2] - (MyVelocity[2] / 100.f) * (40.f / smoothamount);
  290. }
  291.  
  292.  
  293.  
  294. DWORD WINAPI AB(LPVOID params)
  295. {
  296. while (!GetAsyncKeyState(PanicVkeyCode))
  297. {
  298. Sleep(1);
  299.  
  300. if (GetAsyncKeyState(PanicVkeyCode))
  301. {
  302. ExitThread(0);
  303. }
  304.  
  305. if (aimEnabled)
  306. {
  307. int PlayerNumber = NewPlayer.GetCrosshairId();
  308.  
  309. while (GetAsyncKeyState(NewAimVkeyCode) < 0 && NewPlayer.GetShotsFired() > 1 && PlayerNumber < 64 && PlayerNumber >= 0 && EntityList.GetTeam(PlayerNumber) != NewPlayer.GetTeam() && EntityList.IsDead(PlayerNumber) != true)
  310. {
  311. int TempPlayerNumber = NewPlayer.GetCrosshairId();
  312. if (TempPlayerNumber < 64 && TempPlayerNumber >= 0 && EntityList.GetTeam(TempPlayerNumber) != NewPlayer.GetTeam() && EntityList.IsDead(TempPlayerNumber) != true)
  313. {
  314. PlayerNumber = TempPlayerNumber;
  315. }
  316. float PlayerPos[3];
  317. float EnemyPos[3];
  318. float AimAngle[3];
  319. float CurrentAngle[3];
  320. NewPlayer.GetPosition(PlayerPos);
  321. EntityList.GetBonePosition(PlayerNumber, EnemyPos);
  322. VelocityComp(PlayerNumber, EnemyPos);
  323. calcang(PlayerPos, EnemyPos, AimAngle);
  324. AngleNormalize(AimAngle);
  325. NewPlayer.GetAngles(CurrentAngle);
  326. AngleNormalize(CurrentAngle);
  327. SmoothAngleSet(AimAngle, CurrentAngle);
  328. Sleep(1);
  329. }
  330.  
  331. while (lockEnabled != false && PlayerNumber < 64 && PlayerNumber >= 0 && EntityList.GetTeam(PlayerNumber) != NewPlayer.GetTeam() && EntityList.IsDead(PlayerNumber) != true)
  332. {
  333. int TempPlayerNumber = NewPlayer.GetCrosshairId();
  334. if (TempPlayerNumber < 64 && TempPlayerNumber >= 0 && EntityList.GetTeam(TempPlayerNumber) != NewPlayer.GetTeam() && EntityList.IsDead(TempPlayerNumber) != true)
  335. {
  336. PlayerNumber = TempPlayerNumber;
  337. }
  338. float PlayerPos[3];
  339. float EnemyPos[3];
  340. float AimAngle[3];
  341. float CurrentAngle[3];
  342. NewPlayer.GetPosition(PlayerPos);
  343. EntityList.GetBonePosition(PlayerNumber, EnemyPos);
  344. VelocityComp(PlayerNumber, EnemyPos);
  345. calcang(PlayerPos, EnemyPos, AimAngle);
  346. AngleNormalize(AimAngle);
  347. NewPlayer.GetAngles(CurrentAngle);
  348. AngleNormalize(CurrentAngle);
  349. SmoothAngleSet(AimAngle, CurrentAngle);
  350. Sleep(1);
  351. }
  352.  
  353. }
  354. }
  355. }
  356.  
  357.  
  358. int whichKeyIsPressed() {
  359. while (true) {
  360. for (int i = 1; i < 255; i++) {
  361. if (GetAsyncKeyState(i) & 0x8000) {
  362. while (GetAsyncKeyState(i) & 0x8000) {
  363. Sleep(50);
  364. }
  365. return i;
  366. }
  367. }
  368. Sleep(10);
  369. }
  370. }
  371.  
  372.  
  373.  
  374. void ReadData(Player* p) {
  375. p->team = mem.Read<int>(p->dwBase + offEntityTeam);
  376. }
  377.  
  378. int main() {
  379. std::cout << "Testing Testing";
  380. std::cout << "...";
  381. while (!mem.Attach("csgo.exe")) {
  382. std::cout << ".";
  383. Sleep(500);
  384. }
  385. modClient = mem.GetModule("client.dll");
  386. DwClient = modClient.dwBase;
  387.  
  388. modEngine = mem.GetModule("engine.dll");
  389. DwEngine = modEngine.dwBase;
  390.  
  391. Sleep(30);
  392.  
  393. std::cout << "\n\nToggle Aimlock: ";
  394. ForceAimVkeyCode = whichKeyIsPressed();
  395. std::cout << ForceAimVkeyCode << "\n";
  396.  
  397. std::cout << "\n\nToggle Triggerbot: ";
  398. TrigVkeyCode = whichKeyIsPressed();
  399. std::cout << TrigVkeyCode << "\n";
  400.  
  401. std::cout << "Panic Key: ";
  402. PanicVkeyCode = whichKeyIsPressed();
  403. std::cout << PanicVkeyCode << "\n";
  404.  
  405.  
  406. std::cout << "\n";
  407.  
  408. CreateThread(0, 0x1000, &AB, 0, 0, 0);
  409.  
  410. Player me;
  411. Player players[64];
  412.  
  413. while (!GetAsyncKeyState(PanicVkeyCode)) {
  414.  
  415. if (GetAsyncKeyState(ForceAimVkeyCode) & 0x8000) {
  416. while (GetAsyncKeyState(ForceAimVkeyCode) & 0x8000) {
  417. Sleep(50);
  418. }
  419. lockEnabled = !lockEnabled;
  420. std::cout << "Aimlock is now ";
  421. if (lockEnabled) {
  422. std::cout << "enabled\n";
  423. }
  424. else {
  425. std::cout << "disabled\n";
  426. }
  427. }
  428.  
  429. if (GetAsyncKeyState(TrigVkeyCode) & 0x8000) {
  430. while (GetAsyncKeyState(TrigVkeyCode) & 0x8000) {
  431. Sleep(50);
  432. }
  433. trigEnabled = !trigEnabled;
  434. std::cout << "Triggerbot is now ";
  435. if (trigEnabled) {
  436. std::cout << "enabled\n";
  437. }
  438. else {
  439. std::cout << "disabled\n";
  440. }
  441. }
  442.  
  443. /*if (trigEnabled) {
  444. int PlayerNumber = NewPlayer.GetCrosshairId();
  445. if (PlayerNumber < 64 && PlayerNumber >= 0 && EntityList.GetTeam(PlayerNumber) != NewPlayer.GetTeam() && EntityList.IsDead(PlayerNumber) != true)
  446. {
  447. Click();
  448. }
  449. else
  450. {
  451. Sleep(500);
  452. }
  453. }*/
  454.  
  455. if (glowEnabled) {
  456. me.dwBase = mem.Read<DWORD>(DwClient + offLocalPlayer);
  457. ReadData(&me);
  458. for (int i = 1; i < 64; i++) {
  459. players[i].dwBase = mem.Read<DWORD>(DwClient + offEntityList + i * 0x10);
  460. ReadData(&players[i]);
  461. }
  462.  
  463. DWORD pointerGlow = mem.Read<DWORD>(DwClient + offGlow);
  464. int objectCount = mem.Read<int>(DwClient + offGlow + 0x4);
  465. if (pointerGlow != NULL) {
  466. for (int i = 0; i < objectCount; i++) {
  467.  
  468.  
  469. DWORD mObj = pointerGlow + i * sizeof(GlowObjectDefinition_t);
  470. GlowObjectDefinition_t glowObj = mem.ReadNew<GlowObjectDefinition_t>(mObj);
  471.  
  472.  
  473. if (glowObj.pEntity != NULL) {
  474. int f_i = -1;
  475. for (int j = 1; j < 64; j++) {
  476.  
  477. if (glowObj.pEntity == players[j].dwBase) {
  478. if (players[j].team != me.team) {
  479. int r = 0, g = 255, b = 0;
  480. mem.WriteNew<float>(mObj + 0x4, r / 255);
  481. mem.WriteNew<float>(mObj + 0x8, g / 255);
  482. mem.WriteNew<float>(mObj + 0xC, b / 255);
  483. mem.WriteNew<float>(mObj + 0x10, 1.0f);
  484. mem.WriteNew<bool>(mObj + 0x24, true);
  485. mem.WriteNew<bool>(mObj + 0x25, false);
  486.  
  487. }
  488. //if (players[j].team == me.team) {
  489. // r = 0;
  490. // b = 255;
  491. //}
  492.  
  493. }
  494. }
  495. }
  496. }
  497. }
  498. }
  499.  
  500. if (radarEnabled) {
  501. me.dwBase = mem.Read<DWORD>(DwClient + offLocalPlayer);
  502. ReadData(&me);
  503. for (int i = 1; i < 64; i++) {
  504. players[i].dwBase = mem.Read<DWORD>(DwClient + offEntityList + i * 0x10);
  505. ReadData(&players[i]);
  506. }
  507.  
  508. DWORD pointerGlow = mem.Read<DWORD>(DwClient + offGlow);
  509. int objectCount = mem.Read<int>(DwClient + offGlow + 0x4);
  510. if (pointerGlow != NULL) {
  511. for (int i = 0; i < objectCount; i++) {
  512.  
  513. DWORD mObj = pointerGlow + i * sizeof(GlowObjectDefinition_t);
  514. GlowObjectDefinition_t glowObj = mem.ReadNew<GlowObjectDefinition_t>(mObj);
  515.  
  516. if (glowObj.pEntity != NULL) {
  517. int f_i = -1;
  518. for (int j = 1; j < 64; j++) {
  519. if (glowObj.pEntity == players[j].dwBase) {
  520. if (players[j].team != me.team) {
  521. mem.WriteNew<int>(players[j].dwBase + dwSpotted, 1);
  522. }
  523. }
  524. }
  525. }
  526. }
  527. }
  528. }
  529.  
  530. }
  531.  
  532. return 0;
  533. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement