#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
HWND hwnd = FindWindow(NULL, ("Counter-Strike: Global Offensive"));
if (hwnd == 0)
{
cout << "Window not found.\n";
system("PAUSE");
}
else
{
cout << "Window found.\n";
DWORD pId;
GetWindowThreadProcessId(hwnd, &pId);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
if (!hProc)
{
cout << "Could not open process";
system("PAUSE");
}
else
{
cout << "Process opened\n";
DWORD pointer = 0x00A30504;
DWORD pointed;
WORD offset = 0x000000FC;
int currentHealth;
ReadProcessMemory(hProc, (LPCVOID)(pointer), &pointed, 4, NULL);
ReadProcessMemory(hProc, (LPCVOID)(pointed + offset), ¤tHealth, 4, NULL);
cout << "Current Health is: " << currentHealth;
system("PAUSE");
}
}
return 0;
}