OldSchoolHack

Register / Login English

[C++] CS1.6 Auto Shoot

icon Thread: [C++] CS1.6 Auto Shoot

Join Date: Jun 2009

Posts: 6

Hi,

ich habe hier mal einen kleinen Source ...

Sobald der Name des feindlichen Spielers erscheint schießt ihr automatisch.
Ich habe es unter Windows XP getestet.

TEXT Code:
  1.  
  2. #include <iostream>
  3. #include <windows.h>
  4. #include <Tlhelp32.h>
  5.  
  6. #define ON_ENEMY 2
  7.  
  8. using namespace std;
  9.  
  10. HANDLE GetGameHandle ( HWND hWindow );
  11. DWORD GetClientBase ( HWND hWindow );
  12. HWND GetGameHwnd ();
  13.  
  14. int main()
  15. {
  16. short sCrosshair = 0;
  17. short sShoot = 1280;
  18. short sNoShoot = 1024;
  19.  
  20. HWND hWindow = GetGameHwnd();
  21. HANDLE hGame = GetGameHandle(hWindow);
  22.  
  23. if (!hGame)
  24. {
  25. cout << "GetGameHandle failed" << endl;
  26. return -1;
  27. }
  28.  
  29. DWORD dwClientBase = GetClientBase(hWindow);
  30.  
  31. if ( dwClientBase == 0x00 )
  32. {
  33. cout << "GetClientBase failed" << endl;
  34. return -1;
  35. }
  36.  
  37. DWORD dwShoot = dwClientBase + 0x12CF5F;
  38. DWORD dwOnEnemy = dwClientBase + 0x1211F8;
  39.  
  40. while ( !GetAsyncKeyState (VK_F12) & 1 )
  41. {
  42. ReadProcessMemory ( hGame, (void*)(dwOnEnemy), &sCrosshair, sizeof(sCrosshair), NULL );
  43.  
  44. if ( sCrosshair == ON_ENEMY )
  45. {
  46. WriteProcessMemory ( hGame, (void*)(dwShoot), &sShoot, sizeof(sShoot), NULL );
  47. Sleep (20);
  48. WriteProcessMemory ( hGame, (void*)(dwShoot), &sNoShoot, sizeof(sNoShoot), NULL );
  49. Sleep (420);
  50. } Sleep (10);
  51. } return 0;
  52. }
  53.  
  54. HWND GetGameHwnd ()
  55. {
  56. HWND hWindow = NULL;
  57.  
  58. while ( !hWindow )
  59. {
  60. hWindow = FindWindow ( NULL, "Counter-Strike" );
  61. Sleep (500);
  62. cout << "looking for counter-strike ..." << endl;
  63. } cout << "counter-strike found" << endl;
  64. return hWindow;
  65. }
  66.  
  67. HANDLE GetGameHandle ( HWND hWindow )
  68. {
  69. HANDLE hGame = NULL;
  70. DWORD dwPid;
  71.  
  72. GetWindowThreadProcessId ( hWindow, &dwPid );
  73.  
  74. hGame = OpenProcess ( PROCESS_ALL_ACCESS, false, dwPid );
  75.  
  76. if ( hGame )
  77. return hGame;
  78. else return NULL;
  79. }
  80.  
  81. DWORD GetClientBase ( HWND hWindow )
  82. {
  83. HANDLE hSnap = NULL;
  84. MODULEENTRY32 m32;
  85. DWORD dwPid;
  86.  
  87. GetWindowThreadProcessId ( hWindow, &dwPid );
  88.  
  89. m32.dwSize = sizeof (MODULEENTRY32);
  90. hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPid );
  91.  
  92. if ( hSnap == INVALID_HANDLE_VALUE )
  93. {
  94. cout << "CreateToolhelp32Snapshot failed" << endl;
  95. CloseHandle (hSnap);
  96. return 0x00;
  97. }
  98.  
  99. if ( Module32First ( hSnap, &m32 ) )
  100. {
  101. while ( Module32Next ( hSnap, &m32 ) )
  102. {
  103. if ( !strcmp ( m32.szModule , "client.dll" ) )
  104. {
  105. cout << "client base found" << endl;
  106. CloseHandle (hSnap);
  107. return (DWORD)(m32.modBaseAddr);
  108. }
  109. }
  110. } else { cout << "Module32First failed" << endl; };
  111. CloseHandle (hSnap);
  112. return 0x00;
  113. }
  114.  

Vielleicht kann ja jemand was damit anfangen.

Sollte es Probleme geben, versucht es mal mit:
TEXT Code:
  1.  
  2. if ( sCrosshair > 1 )
  3.  

MfG

nookstar