Results 1 to 3 of 3
  1. #1
    Delision's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Minnesota, US
    Posts
    200
    Reputation
    10
    Thanks
    786
    My Mood
    Mellow

    Question Help with incorporating static address & offsets into C++ with Assault Cube

    As the title states, I am having some trouble getting my cheat to work with static addresses and offsets. Here's my code:

    Code:
    int main()
    {
        int newAmmoValue = 999;
        HWND hWnd = FindWindow(0, "AssaultCube");
        if (hWnd == 0) {
            cout << "Cannot find window." << endl;
            Sleep(5000);
        } else {
            DWORD pId;
            GetWindowThreadProcessId(hWnd, &pId);
            HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
    
            if (!hProc) {
                cout << "Cannot open process." << endl;
                Sleep(5000);
            } else {
                    static int LMGoffset = 0x150;
                    int PlayerBase = 0x00509B74;
                    int LmgAddress= PlayerBase + LMGoffset;
    
                int success = WriteProcessMemory(hProc, (LPVOID)LmgAddress, &newAmmoValue, (DWORD)sizeof(newAmmoValue), NULL);
    
                if (success > 0) {
                    cout << "Success." << endl;
                    Sleep(5000);
                }
                else {
                    cout << "Failure." << endl;
                    Sleep(5000);
                }
                CloseHandle(hProc);
            }
        }
    
    }
    I bolded "LmgAmmo" in the code, because that is where I am running into trouble. With the code the way it is right now, I get a full execution of the code and get "Success." returned to me, but the value associated with LmgAddress is not changed. If I replace LmgAddress with a dynamic address I find using cheat engine, my code works to change the ammo. But for some reason when I replace that address with the static address + offset it will not change the value in game. If I go into cheat engine and input the static address with the offset, I can change the ammo from there like normal, so I'm not sure why it is not working in my code.
    Here's an actual picture of me.

  2. #2
    Delision's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Minnesota, US
    Posts
    200
    Reputation
    10
    Thanks
    786
    My Mood
    Mellow
    Problem fixed. This thread can be locked.
    Here's an actual picture of me.

  3. #3
    Hugo Boss's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Posts
    28,752
    Reputation
    4790
    Thanks
    5,902
    My Mood
    Angelic
    Closed, since solved.

     
    Super User since 08-29-2017
    Global Moderator from 10-02-2016 - 08-29-2017
    Premium Seller since 11-16-2016
    Moderator from 09-24-2015 - 01-09-2016
    Alliance of Valiant Arms Minion from 11-12-2015 - 01-09-2016
    Market place Minion from 09-24-2015 - 01-09-2016
    Crossfire Minion from 09-11-2015 - 01-09-2016

    Middleman from 07-07-2015 - 01-09-2016
    Market Place Minion from 03-03-2014 - 08-01-2014
    Middleman from 01-30-2014 - 08-01-2014
    Moderator from 03-29-2013 - 04-04-2013
    Market Place Minion from 03-07-2013 - 04-04-2013
    Premium Member since 01-25-2013
    Middleman from 12-04-2012 - 04-04-2013
    Registered since 10-9-2011

  4. The Following User Says Thank You to Hugo Boss For This Useful Post:

    Delision (01-12-2017)

Similar Threads

  1. [Help Request] Help PointerWrite (Pointers lvls4 with 4 and 5 offsets) Pointers & Offsets
    By jonnyHS in forum Visual Basic Programming
    Replies: 10
    Last Post: 10-08-2013, 03:43 PM
  2. [Help Request] Can somebody help me with putting in the Menu into folder etc.
    By Pelops in forum DayZ Help & Requests
    Replies: 0
    Last Post: 07-09-2013, 02:22 PM
  3. Replies: 1
    Last Post: 08-02-2012, 01:14 PM
  4. [Help] Please help, addresses, offsets etc
    By _corn_ in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 13
    Last Post: 12-30-2011, 08:44 AM
  5. I Need Help With Cross-Modding Default Guns Into Better Ones
    By Uneedbackup in forum Combat Arms Mod Discussion
    Replies: 5
    Last Post: 06-17-2010, 03:22 AM

Tags for this Thread