Results 1 to 7 of 7

Threaded View

  1. #1
    solidpants's Avatar
    Join Date
    May 2013
    Gender
    male
    Location
    Texas
    Posts
    102
    Reputation
    10
    Thanks
    34
    My Mood
    Yeehaw

    Question Still kind of new to C++ and have question about static addresses

    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);
    }

    }
    Last edited by solidpants; 06-25-2013 at 06:24 PM. Reason: didn't copy the whole hack

Similar Threads

  1. [Solved] have question about No flash hack
    By phillyfunguy in forum CrossFire Help
    Replies: 8
    Last Post: 01-16-2012, 06:53 PM
  2. G-Force have questions about CA hacks
    By NoJustice in forum Combat Arms Discussions
    Replies: 15
    Last Post: 07-05-2011, 02:13 PM
  3. I'm new to c++ and have a question about pointers
    By I.P in forum C++/C Programming
    Replies: 2
    Last Post: 05-26-2011, 10:31 PM
  4. New to the Forum. Some questions about MW2 Hacks
    By techmando in forum Call of Duty Modern Warfare 2 Discussions
    Replies: 8
    Last Post: 04-27-2010, 03:42 PM
  5. have question about some hacks
    By rino1992 in forum WarRock - International Hacks
    Replies: 5
    Last Post: 12-31-2007, 08:51 AM