this is my source code for my trainer if any any one could tell me the offset for the ammo and health it would be awesome
and if i made any mistakes please tell me. I am very new at this this is my first hack i ever made so don't judge me :P
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>
void WriteToMemory(HANDLE hProcHandle);
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);
std::string GameName = "Call of Duty® Ghosts Multiplayer";
LPCSTR LGameWindow = "Call of Duty® Ghosts Multiplayer";
std::string GameStatus;
bool IsGameAvail;
bool UpdateOnNextRun;
//AMMO VARS
bool AmmoStatus;
BYTE AmmoValue[] = {0xA3,0x1C,0x0,0x0};
DWORD AmmoBaseAddress = {0x1443BAADC};
DWORD AmmoOffsets[] = {0x,0x14,0x0};
//Health VARS
bool HealthStatus;
BYTE HealthValue[] = {0x39,0x5,0x0,0x0};
DWORD HealthBaseAddress = {0x1441E9F3C};
DWORD HealthOffsets[] = {0x};
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;
std::string sHealthStatus;
sAmmoStatus = "OFF";
sHealthStatus = "OFF";
OnePressTMR = clock();
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 vaild handle";
}
else
{
GameStatus = "Ghosts ready to Hack";
IsGameAvail = true;
}
}
else GameStatus = "Failed to get process ID";
}
else GameStatus = "Ghosts NOT FOUND" ;
if(UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000)
{
system("cls");
std::cout << ".........................................." << std::endl;
std::cout << " Ghost Trainer Made By WTF_Fire_Fly" << std ::endl;
std::cout << ".........................................." << std::endl<<std::endl;
std::cout << "Game Status:" << GameStatus << std::endl<<std::endl;
std::cout << "[F1] Unlimited Ammo -> " << sAmmoStatus << "<-" << std::endl<<std::endl;
std::cout << "[F2] God Mode -> " << sHealthStatus << "<-" << std::endl<<std::endl;
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";
}
}
}
}
CloseHandle(hProcHandle);
CloseHandle(hGameWindow);
return ERROR_SUCCESS;
}
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
DWORD pointer = BaseAddress;
DWORD pTemp ;
DWORD pointerAddr ;
for(int i = 0 ; i < PointerLevel ; i++)
{
if(i == 0)
{
ReadProcessMemory(hProcHandle , (LPCVOID)pointer , &pTemp , 4 , NULL );
}
pointerAddr = pTemp + Offsets[i];
ReadProcessMemory(hProcHandle , (LPCVOID)pointerAddr , &pTemp , 4 , 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);
}
}