#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include <io.h>
using namespace std;
uintptr_t moduleBase;
HANDLE TargetProccess;
HWND GameHWND;
DWORD flashDuration = 0x10470; // Flash duration offset
uintptr_t isSpotted = 0x93D; // Enemy tags on radar
int flashDur = 0;
template <typename T> T RPM(SIZE_T address) {
T buffer;
ReadProcessMemory(TargetProccess, (LPCVOID)address, &buffer, sizeof(T), NULL);
return buffer;
}
template <typename T>
void WPM(DWORD address, T value) {
WriteProcessMemory(TargetProccess, (LPVOID)address, &value, sizeof(value), 0);
}
uintptr_t GetModuleBaseAddress(DWORD dwPid, const wchar_t* moduleName) {
uintptr_t dwBase = 0;
do {
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, dwPid);
if (hSnapshot == INVALID_HANDLE_VALUE) continue;
MODULEENTRY32 ModuleEntry32;
ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
if (Module32First(hSnapshot, &ModuleEntry32)) {
do {
if (!wcscmp(ModuleEntry32.szModule, moduleName)) {
dwBase = (DWORD)ModuleEntry32.modBaseAddr;
break;
}
} while (Module32Next(hSnapshot, &ModuleEntry32));
}
CloseHandle(hSnapshot);
} while (!dwBase);
return dwBase;
}
//Making glow
void makeGlow(uintptr_t glowObj, int glowIndx) {
WPM<float>(glowObj + glowIndx * 0x38 + 0x8, 0); // red
WPM<float>(glowObj + glowIndx * 0x38 + 0xC, 255); // green
WPM<float>(glowObj + glowIndx * 0x38 + 0x10, 9); // blue
WPM<float>(glowObj + glowIndx * 0x38 + 0x14, 1); // alpha
WPM<bool>(glowObj + glowIndx * 0x38 + 0x28, 1); // enable glow if 1, disabled if 0
WPM<bool>(glowObj + glowIndx * 0x38 + 0x29, 0);
}
//Enabling Wallhack
void wallHack() {
uintptr_t dwGlowManager = RPM<uintptr_t>(moduleBase + dwGlowObjectManager);
int localTeam = RPM<int>(RPM<uintptr_t>(moduleBase + dwEntityList) + m_iTeamNum);
for (int i = 0; i < 64; i++) {
uintptr_t pEnt = RPM<uintptr_t>(moduleBase + dwEntityList + i * 0x10);
radarHack(pEnt); // radar
int enemyPlayer = RPM<int>(pEnt + m_iTeamNum);
if (pEnt == 0 || localTeam == enemyPlayer) continue;
int iGlowIndx = RPM<int>(pEnt + m_iGlowIndex);
makeGlow(dwGlowManager, iGlowIndx);
}
}
//Enabling Radar
void radarHack(uintptr_t entity) {
WPM<bool>(entity + isSpotted, 1);
}
//Antiflash
void antiFlash(uintptr_t localplayer) {
flashDur = RPM<int>(localplayer + flashDuration);
if (flashDur > 0) {
WPM<int>(localplayer + flashDuration, 0);
}
}
//Run cheats
void activateHacks() {
while (true) {
uintptr_t localPlayer = RPM<DWORD>(moduleBase + dwLocalPlayer);
if (GetKeyState(VK_F1) & 1) {
wallHack();
}
if (GetKeyState(VK_F2) & 1) {
antiFlash(localPlayer);
}
Sleep(1);
}
}