Source Code First AssaultCube Trainer.

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

st3k

Dank Tier Donator
Oct 29, 2019
29
283
1
How long you been coding/hacking?
Almost 1 month
Coding Language
C++
Hi.

Started coding and hacking for a little less than a month ago, finished my first external AssaultCube trainer today. Posting it here in case some other beginners like me find it useful.

Feedback is appreciated :)


main.cpp:
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include "acOffsets.h"



int main()
{
    //Find the AssaultCube window.
    HWND window = FindWindowA(NULL, "AssaultCube");
    
    //Error checking.
    if (window != NULL)
    {
        Sleep(1000);
        std::cout << "Window found.\n";
    }
    else
    {
        std::cout << "Can not find window..\nError code = " << GetLastError() << "\n";
        Sleep(3000);
        exit(1);
    }

    //Get processID of the AssaultCube window.
    DWORD procId;
    GetWindowThreadProcessId(window, &procId);
    
    //Error checking.
    if (GetWindowThreadProcessId != NULL)
    {
        Sleep(500);
        std::cout << "Found target process.\n";
    }
    else
    {
        std::cout << "Can not find target process.\nError code = " << GetLastError() << "\n";
        Sleep(3000);
        exit(1);
    }

    //Get a handle to the AssaultCube process.
    HANDLE procHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procId);
    
    //Error checking.
    if (procHandle != NULL)
    {
        Sleep(1500);
        std::cout << "Got a handle to the process.\n";
    }
    else
    {
        std::cout << "Can not get handle to target process.\nError code = " << GetLastError() << "\n";
        Sleep(3000);
        exit(1);
    }


    //Get dynamic player adress, for each restart of process.
    DWORD dynamicPlayer;
    ReadProcessMemory(procHandle, LPCVOID(0x50F4F4), &dynamicPlayer, sizeof(dynamicPlayer), 0);
    
    //Error checking.
    if (ReadProcessMemory != FALSE)
    {
        Sleep(1000);
        std::cout << "Memory successfully read.\n";
        Sleep(500);
        std::cout << "Cheat is active\n\n";

    }
    else
    {
        std::cout << "Can not read the memory of the process.\nError code = " << GetLastError() << "\n";
        Sleep(3000);
        CloseHandle(procHandle);
        exit(1);
    }

    Sleep(3000);

    //Declaring header file structs.
    Offsets offs;
    Values val;

    system("CLS");
    std::cout << "~~~~~~ st3k's AssaultCube Trainer. ~~~~~~\n\n";
    std::cout << "------------- Controls/Info -------------\n\n";
    std::cout << "Hold [Q] to use speedhack.\n\n";
    std::cout << "---------------\n\n";
    std::cout << "Health = " << val.healthValue << "\n";
    std::cout << "Ammo = " << val.rifleAmmoValue << "\n";
    std::cout << "Armor = " << val.armorValue << "\n";
    std::cout << "Grenades = " << val.grenadeValue << "\n";
    std::cout << "\n\nPress [END] to exit.\n";;

    
    
    
    //Looping through WriteProcessMemory to make the changed values static.
    while (true)
    {
        //Set health value to 1999
        WriteProcessMemory(procHandle, LPVOID(dynamicPlayer + offs.healthOffset), &val.healthValue, sizeof(val.healthValue), NULL);
        
        //Set rifle ammo value to 1999
        WriteProcessMemory(procHandle, LPVOID(dynamicPlayer + offs.rifleAmmoOffset), &val.rifleAmmoValue, sizeof(val.rifleAmmoValue), NULL);

        //Set grenade ammo to 10
        WriteProcessMemory(procHandle, LPVOID(dynamicPlayer + offs.grenadeAmmo), &val.grenadeValue, sizeof(val.grenadeValue), NULL);

        //Set pistol ammo value to 1999
        WriteProcessMemory(procHandle, LPVOID(dynamicPlayer + offs.pistolAmmo), &val.pistolammoValue, sizeof(val.pistolammoValue), NULL);

        //Set armor value to 100
        WriteProcessMemory(procHandle, LPVOID(dynamicPlayer + offs.armorOffset), &val.armorValue, sizeof(val.armorValue), NULL);

        





        //Speedhack while holding "Q"
        while (GetAsyncKeyState(0x51))
        {
            WriteProcessMemory(procHandle, LPVOID(dynamicPlayer + offs.speedOffset), &val.speedValue, sizeof(val.speedValue), NULL);
        }





        if (GetAsyncKeyState(VK_END))break;


        Sleep(1);
    }


    CloseHandle(procHandle);

    return 0;
}


I have the offsets and values in a header file to make it look clean.

1574543002657.png



acOffsets.h:
#pragma once
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>


//Offsets for different stuff
struct Offsets
{
    DWORD healthOffset = 0xF8;
    DWORD rifleAmmoOffset = 0x150;
    DWORD speedOffset = 0x80;
    DWORD grenadeAmmo = 0x158;
    DWORD pistolAmmo = 0x13C;
    DWORD armorOffset = 0xFC;
    
};


//What to change the values to.
struct Values
{
    int healthValue = 1999;
    int rifleAmmoValue = 1999;
    int speedValue = 4;
    int grenadeValue = 10;
    int pistolammoValue = 1999;
    int armorValue = 100;
    

};


Console:

1574542987284.png



Thank you for the tutorials on this site. 🍻
 

BDKPlayer

No hack no life
Dank Tier VIP
Dank Tier Donator
Oct 31, 2013
383
13,688
36
Does that do what it should do? I really should know but I think it doesnt
C++:
if (ReadProcessMemory != FALSE)
Doesnt that just check the address of ReadProcessMemory against 0?
 
  • Wow
Reactions: TorCracker

TorCracker

Full Member
Nobleman
Jul 13, 2019
58
1,213
1
Does that do what it should do? I really should know but I think it doesnt
C++:
if (ReadProcessMemory != FALSE)
Doesnt that just check the address of ReadProcessMemory against 0?
maybe it:
if(ReadProcessMemory(procHandle, LPCVOID(0x50F4F4), &dynamicPlayer, sizeof(dynamicPlayer), 0))
{
std::cout << "Memory successfully read.\n";
}
 

st3k

Dank Tier Donator
Oct 29, 2019
29
283
1
Does that do what it should do? I really should know but I think it doesnt
C++:
if (ReadProcessMemory != FALSE)
Doesnt that just check the address of ReadProcessMemory against 0?
Yes, it is not working as i intended. Thanks for the feedback :)
 
Last edited:

lukaluka

Coder
Meme Tier VIP
Jul 6, 2015
285
1,213
3
if you using dll inject, make sure use memcpy instead of readprocessmemory, so no need to worry if readprocessmemory is hooked
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods