Reply to thread

Hi! I was bored and I decided to make a simple external hack for CoD 4 offline. This just consists of 3 main things, Fly Hack, FOV Toggle, and Unlimited Ammo Toggle. I hope y'all enjoy the source!


[CODE]

#include <iostream>

#include <Windows.h>


using namespace std;

DWORD pID;


DWORD myX = 0x13255C8;

DWORD myY = 0x13255CC;

DWORD myZ = 0x13255C4;


DWORD myFOV = 0xCBAF114;


DWORD primaryAmmo = 0x1325940;

DWORD secondaryAmmo = 0x13259BC;


char user;


float X, Y, Z;


float outOfMapX = -88;

float outOfMapY = -27;

float outOfMapZ = 3433;


bool flyHack = false;


bool toggleFOV;

float proFOV = 90;

float normFOV;

float stockFOV = 65;


bool infiniteAmmo = false;

int storePrimary, storeSecondary;

int maxAmmo = 9999;


int main()

{

    cout << "Please Enter a Name. (NO SPACES & ONLY 1 CAPITAL LETTER)" << endl;

    cin >> user;

    cout << "******************************************************************************" << endl;

    cout << "*Welcome " << user << " to FloppyWhale's External CoD 4 Test Hack!            *" << endl;

    cout << "*These Hacks are for OFFLINE ONLY!                                            *" << endl;

    cout << "******************************************************************************" << endl;

    cout << "Press F1 In-Game to Teleport to the Outside of Crossfire. (MAY WORK ON OTHER MAPS)" << endl;

    cout << endl;

    cout << "Press F2 to Toggle FOV. (BUGGY)" << endl;

    cout << endl;

    cout << "Press F3 to Toggle Infinite Ammo." << endl;

    cout << endl;

    cout << "Hold SPACE In-Game to Fly." << endl;

    cout << endl;


    while(true)

    {

        HWND hWnd = FindWindowA(0, ("Call of Duty 4"));

        GetWindowThreadProcessId(hWnd, &pID);

        HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, false, pID);


        ReadProcessMemory(pHandle, (LPVOID)myY, &Y, sizeof(Y), 0);

        ReadProcessMemory(pHandle, (LPVOID)myX, &X, sizeof(X), 0);

        ReadProcessMemory(pHandle, (LPVOID)myZ, &Z, sizeof(Z), 0);

        ReadProcessMemory(pHandle, (LPVOID)myFOV, &normFOV, sizeof(normFOV), 0);


        if (GetAsyncKeyState(VK_F1))

        {

            WriteProcessMemory(pHandle, (LPVOID)myY, &outOfMapY, sizeof(outOfMapY), 0);

            WriteProcessMemory(pHandle, (LPVOID)myX, &outOfMapX, sizeof(outOfMapX), 0);

            WriteProcessMemory(pHandle, (LPVOID)myZ, &outOfMapZ, sizeof(outOfMapZ), 0);

        }


        if (GetAsyncKeyState(VK_F2))

        {

            if (!toggleFOV)

            {

                WriteProcessMemory(pHandle, (LPVOID)myFOV, &proFOV, sizeof(proFOV), 0);

                toggleFOV = true;

            }

            else

            {

                WriteProcessMemory(pHandle, (LPVOID)myFOV, &stockFOV, sizeof(stockFOV), 0);

                toggleFOV = false;

            }

              

        }


        if (GetAsyncKeyState(VK_F3))

        {

            if (!infiniteAmmo)

            {

                ReadProcessMemory(pHandle, (LPVOID)primaryAmmo, &storePrimary, sizeof(storePrimary), 0);

                ReadProcessMemory(pHandle, (LPVOID)secondaryAmmo, &storeSecondary, sizeof(storeSecondary), 0);


                WriteProcessMemory(pHandle, (LPVOID)primaryAmmo, &maxAmmo, sizeof(maxAmmo), 0);

                WriteProcessMemory(pHandle, (LPVOID)secondaryAmmo, &maxAmmo, sizeof(maxAmmo), 0);


                infiniteAmmo = true;

            }

            else

            {

                WriteProcessMemory(pHandle, (LPVOID)primaryAmmo, &storePrimary, sizeof(storePrimary), 0);

                WriteProcessMemory(pHandle, (LPVOID)secondaryAmmo, &storeSecondary, sizeof(storeSecondary), 0);


                infiniteAmmo = false;

            }

        }


        if (GetAsyncKeyState(VK_SPACE))

        {

            float newY = Y += 0.01;

            WriteProcessMemory(pHandle, (LPVOID)myY, &newY, sizeof(newY), 0);

        }


        Sleep(100);

    }

}

[/CODE]


I do realize a good 20% of this is redundant but who cares? :tonguewink: If any of you have any suggestions, please do post them. :grinning:


Top