Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › my static + offsets code doesnt work

Questionmy static + offsets code doesnt work

Posts 1–3 of 3 · Page 1 of 1
MA
MartinMorcos
my static + offsets code doesnt work
i am trying to make a external trainer that just overwrite the current address , everything goes very well till the writing part
every time i press F1 i get a fatel error =D and F2 doesnt work i got the static address and offsets and iam sure that they are 100% for a game called "AssaultCube" so Here's my code:


#include <iostream>
#include <Windows.h>
#include <ctime>
#include <string>

using namespace std;
void WritetoMemory(HANDLE hProcess);
DWORD find(int PointerLevel, HANDLE hProcess, DWORD offset[], DWORD BaseAddress);



string GameName = "AssaultCube";
LPCSTR LGameWindow = "AssaultCube";
string GameStatus;

bool isgameavail;
bool updateonNextrun;

//Ammo
bool AmmoStatus;
BYTE AmmoValue[] = { 0xA4, 0x1C, 0x0, 0x0 };
DWORD AmmoOFFsets[] = { 0x384,0x14,0x0 };
DWORD AmmoBaseAddress = { 0x00509B74 };
//HP
bool HPStatus;
BYTE HPValue[] = { 0x39, 0x5, 0x0, 0x0 };
DWORD HPOFFsets[] = { 0xF8 };
DWORD HPBaseAddress = { 0x0050F4F4 };


int main(){
system("Color B");
HWND hGameWindow = NULL;
HANDLE hProcess = NULL;
DWORD pid = NULL;
int isgameavailTMR = clock();
int onepressTMR = clock();
int timeSinceLastUpdate = clock();
updateonNextrun = true;
string sAmmo = "OFF";
string sHP = "OFF";
while (!GetAsyncKeyState(VK_INSERT)){
if (clock() - isgameavailTMR > 100){
isgameavailTMR = clock();
isgameavail = false;
hGameWindow = FindWindow(NULL, LGameWindow);
if (hGameWindow){
GetWindowThreadProcessId(hGameWindow, &pid);
if (pid != 0){
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (hProcess == INVALID_HANDLE_VALUE || hProcess == NULL){
GameStatus = "No Process Found\n";
}
else{
GameStatus ="Game is Ready for Hack\n";
isgameavail = true;
}
}
else{
GameStatus = "Invalid Process\n";
}
}
else{
GameStatus = " Game: NOT FOUND!!\n";
}
if (updateonNextrun || clock() - timeSinceLastUpdate > 5000){
system("cls");
cout << "===============================" << endl;
cout << " AssaultCube " << endl;
cout << "===============================" << endl;
cout << "GameStatus" << GameStatus << endl;
cout << "[F1] Unlimited Ammo -> " << sAmmo << " <-" << endl;
cout << "[F2] HP -> " << sHP << " <-" << endl;
cout << "[INSERT] Exit" << endl;
updateonNextrun = false;
timeSinceLastUpdate = clock();
}
if (isgameavail){
WritetoMemory(hProcess);
}
}
if (clock() - onepressTMR > 400){
if (isgameavail){
if (GetAsyncKeyState(VK_F1)){
onepressTMR = clock();
AmmoStatus = !AmmoStatus;
updateonNextrun = true;
if (AmmoStatus) sAmmo = "ON";
else sAmmo = "OFF";
}
if (GetAsyncKeyState(VK_F2)){
onepressTMR = clock();
HPStatus = !HPStatus;
updateonNextrun = true;
if (HPStatus) sHP = "ON";
else sHP = "OFF";
}

}

}
}
return ERROR_SUCCESS;
}

DWORD find(int PointerLevel, HANDLE hProcess,DWORD OFFsets[], DWORD BaseAddress){
DWORD Pointer = BaseAddress;
DWORD ptemp;
DWORD Pointeraddr;
for (int i = 0; i < PointerLevel; i++){
if (i == 0){
ReadProcessMemory(hProcess, (LPCVOID)Pointer, &ptemp, sizeof(ptemp), NULL);
}
Pointeraddr = Pointer + OFFsets[i];
ReadProcessMemory(hProcess, (LPCVOID)Pointeraddr,&ptemp, sizeof(ptemp), NULL);
}
return Pointeraddr;
}

void WritetoMemory(HANDLE hProcess){
DWORD AddresstoWrite;
if (AmmoStatus){
AddresstoWrite = find(3, hProcess,AmmoOFFsets ,AmmoBaseAddress);
WriteProcessMemory(hProcess, (BYTE*)AddresstoWrite, &AmmoValue, sizeof(AmmoValue), NULL);
}
if (HPStatus){
AddresstoWrite = find(1, hProcess, HPOFFsets, HPBaseAddress);
WriteProcessMemory(hProcess, (BYTE*)AddresstoWrite, &HPValue,sizeof(HPValue), NULL);
}
}
#1 · 11y ago
ER
ERGaergaergaergaergearg
One question, do you even know what any of this code does?

And make sure to post it in [code] tags.
#2 · 11y ago
MA
MartinMorcos
u need to know what the whole code means? ...
from int main()
its basically checking every 5 seconds whether the game is opened or not
closes when i press insert button
(clock() - onepressTMR > 400)
is the timer of the ON or OFF every 4 milliseconds when i press F1 or F2 so that the console doesnt crush
ofc hProcess = GetWindowThreadProcessId is to get the pid of the game when u press Alt + crtl + delete in the process tab
DWORD find function is to read address with OFFSETS which maybe i have an error with it
and last WritetoMemory function is to write on it =D thats the summary of the code + iam here for solutions not explaining my code...
#3 · 11y ago
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

  • Okay ..so i adjusted the code a little bit but still doesnt work..By moathebest in CrossFire Hack Coding / Programming / Source Code
    9Last post 14y ago
  • WPE doesnt work anymore!!!!!!!!!!!!!!!!!!!!By kayhesse in WarRock - International Hacks
    3Last post 20y ago
  • The Weopons hack doesnt work???By Coolman in WarRock - International Hacks
    18Last post 20y ago
  • Warrok Doesnt work for me!?!?!By acepwnage in General Gaming
    8Last post 20y ago
  • DS2 doesnt workBy acepwnage in General Gaming
    1Last post 20y ago

Tags for this Thread

#address#assaultcube#offset#solution#static