Hi, i recently coded my first hack(in c++) for a game called AssaultCube and i had to go through a process of finding the static address using cheat engine, i was wondering if i have to do the same for combat arms or can i find the static addresses on this site or online somewhere else? Also will i #include the same things as i did in my hack
I am still kind of new to C++ so don't make fun of me if this is a ridiculously stupid question, I'm just trying to join this world of programming.
here is my hack for AssaultCube:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>
DWORD FindDmaAddy (int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);
void WriteToMemory(HANDLE hProcHandle);
std::string GameName = "AssaultCube";
LPCSTR LGameWindow = "AssaultCube";
std::string GameStatus;
bool IsGameAvail;
bool UpdateOnNextRun;
//AMMO VARS
bool AmmoStatus;
BYTE AmmoValue[] = {0xA3, 0x1C, 0x0, 0x0};
DWORD AmmoBaseAddress = {0x004DF73C};
DWORD AmmoOffsets[] = {0x378, 0x14, 0x0};
//HEALTH VARS
bool HealthStatus;
BYTE HealthValue[] = {0x39, 0x5, 0x0, 0x0};
DWORD HealthBaseAddress = {0x004DF73C};
DWORD HealthOffsets[] = {0xF4};
int main()
{
HWND hGameWindow = NULL;
int timeSinceLastUpdate = clock();
int GameAvailTMR = clock();
int onePressTMR = clock();
DWORD dwProcID = NULL;
HANDLE hProcHandle = NULL;
UpdateOnNextRun = true;
std::string sAmmoStatus = "OFF";
std::string sHealthStatus = "OFF";
while (!GetAsyncKeyState(VK_INSERT))
{
if(clock() - GameAvailTMR > 100)
{
GameAvailTMR = clock();
IsGameAvail = false;
hGameWindow = FindWindow(NULL, LGameWindow);
if(hGameWindow)
{
GetWindowThreadProcessId( hGameWindow, &dwProcID);
if (dwProcID != 0)
{
hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID );
if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
{
GameStatus = "Failed to open process for valid handle";
}
else
{
GameStatus = "AssaultCube ready to hack";
IsGameAvail = true;
}
}
else
{
GameStatus = "failed to get process ID";
}
}
else
{
GameStatus = "Assaultcube NOT FOUND";
}
if(UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000)
{
system ("cls");
std::cout << "--------------------------------------" << std::endl ;
std::cout << " AssaultCube Ammo and Health Hacker\n";
std::cout << "--------------------------------------" << std::endl << std::endl;
std::cout << "GameStatus:" << GameStatus <<std::endl << std::endl;
std::cout << "[F1] Unlimited Ammo ->" <<sAmmoStatus << "<-\n\n";
std::cout << "[F2] Unlimited Health ->" <<sHealthStatus << "<-\n\n";
std::cout << "[INSERT] Exit" << std::endl;
UpdateOnNextRun = false;
timeSinceLastUpdate = clock();
}
if(IsGameAvail)
{
WriteToMemory(hProcHandle);
}
}
if(clock() - onePressTMR > 400)
{
if(IsGameAvail)
{
//Ammo
if(GetAsyncKeyState(VK_F1))
{
onePressTMR = clock();
AmmoStatus = !AmmoStatus;
UpdateOnNextRun = true;
if(AmmoStatus)sAmmoStatus = "ON";
else sAmmoStatus = "OFF";
}
//Health
else if(GetAsyncKeyState(VK_F2))
{
onePressTMR = clock();
HealthStatus = !HealthStatus;
UpdateOnNextRun = true;
if(HealthStatus)sHealthStatus = "ON";
else sHealthStatus = "OFF";
}
}
}
}
return ERROR_SUCCESS;
}
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
DWORD pointer = BaseAddress;
DWORD pTemp;
DWORD pointerAddr;
for(int c = 0; c < PointerLevel; c++)
{
if(c == 0)
{
ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
}
pointerAddr = pTemp + Offsets[c];
ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof(pTemp), NULL);
}
return pointerAddr;
}
void WriteToMemory(HANDLE hProcHandle)
{
DWORD AddressToWrite;
if(AmmoStatus)
{
AddressToWrite = FindDmaAddy(3, hProcHandle, AmmoOffsets, AmmoBaseAddress);
WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &AmmoValue, sizeof (AmmoValue), NULL);
}
if(HealthStatus)
{
AddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddress);
WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &HealthValue, sizeof (HealthValue), NULL);
}
}