Advertisement
Guest User

Untitled

a guest
Mar 19th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. // csgohacks.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "hackprocess.h"
  6. #include <Windows.h>
  7. #include <iostream>
  8. #include <stdio.h>
  9. #define INS_KEY 0x75
  10. CHackProcess fProcess;
  11.  
  12. const DWORD m_dwLocalplayer = 0xAAD6E8;
  13. const DWORD m_dwAttack = 0x02F108C0;
  14. const DWORD m_dwTeamoffset = 0xF0;
  15. //const DWORD m_dwMaxPlayers = 0x00000308;
  16. const DWORD m_dwCrosshairOffset = 0xAA70;
  17. const DWORD m_dwEntityList = 0x4AD0884;
  18. const DWORD m_dwEntityLoopDist = 0x10;
  19. const DWORD m_dwPlayers = 0x308;
  20.  
  21. DWORD m_dwClientState = 0x5CB524;
  22. DWORD dwClientState;
  23.  
  24.  
  25. bool justShot = false;
  26.  
  27. int i_shoot = 5;
  28. int i_dontshoot = 4;
  29. int i_playersnum = 32;
  30.  
  31. struct LocalPlayer {
  32. DWORD CLocalPlayer;
  33. int Team;
  34. int CrosshairEntityId;
  35. void Read() {
  36. //me parse as byte
  37. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + m_dwLocalplayer), &CLocalPlayer, sizeof(DWORD), 0);
  38. //client state
  39. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + m_dwClientState), &dwClientState, sizeof(DWORD), 0);
  40. //team
  41. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + m_dwTeamoffset), &CLocalPlayer, sizeof(int), 0);
  42. //who im aiming at
  43. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + m_dwCrosshairOffset), &CrosshairEntityId, sizeof(int), 0);
  44. //player num
  45. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(dwClientState + m_dwPlayers), &i_playersnum, sizeof(int), 0);
  46. }
  47. }LocalPlayer;
  48.  
  49.  
  50. struct PlayerList {
  51. DWORD CBaseEntity;
  52. int Team;
  53.  
  54. void Read(int Player) {
  55. //where they are times by loop dist each player has 0x10 sections of mem & store details
  56. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + m_dwEntityList + (Player*m_dwEntityLoopDist)), &CBaseEntity, sizeof(DWORD), 0);
  57. //what team are they
  58. ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + m_dwTeamoffset), &Team, sizeof(int), 0);
  59.  
  60. }
  61. }PlayerList[32];
  62.  
  63. void Trigger() {
  64. //dont shoot conditions
  65. // if aiming at nothing(wall.. etc) go back
  66. if (LocalPlayer.CrosshairEntityId == 0) {
  67. return;
  68. }
  69. // its a friendly go back
  70. if (PlayerList[LocalPlayer.CrosshairEntityId - 1].Team == LocalPlayer.Team) {
  71. std::cout << "Friendly!" << std::endl;
  72. return;
  73. }
  74. // if you're looking at an entity e.g gun on floor, barrel dont shoot. dont check above number of players exist
  75. if (LocalPlayer.CrosshairEntityId > i_playersnum) {
  76. return;
  77. std::cout << "Other Ent!" << std::endl;
  78. }
  79. if (!justShot)
  80. { //if just shot, call -attack so it shoots again
  81. WriteProcessMemory(fProcess.__HandleProcess, (int*)(fProcess.__dwordClient + m_dwAttack), &i_dontshoot, sizeof(int), NULL);
  82. justShot = !justShot;
  83. }
  84.  
  85. if (justShot) {
  86. WriteProcessMemory(fProcess.__HandleProcess, (int*)(fProcess.__dwordClient + m_dwAttack), &i_shoot, sizeof(int), NULL);
  87. justShot = !justShot;
  88. }
  89.  
  90. }
  91.  
  92. int main() {
  93. std::cout << "Check 1" << std::endl;
  94.  
  95. fProcess.RunProcess(); // make sure cs is running
  96. std::cout << "Running" << std::endl;
  97.  
  98. while (!GetAsyncKeyState(VK_F4))
  99. {
  100. LocalPlayer.Read();
  101. for (int i = 0; i < i_playersnum; i++)
  102. {
  103. PlayerList[i].Read(i);
  104. //std::cout << PlayerList[i].Team << std::endl;
  105.  
  106. }
  107.  
  108.  
  109. Trigger();
  110. }
  111. std::cout << "Check 2" << std::endl;
  112.  
  113. return 0;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement