Solved Learning how to hack any game

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

erick_sx

Newbie
Dec 19, 2016
2
12
0
Hey friend (or someone who did and worked), o did C classes and C++ its a little different and i'm not fluent in english but i understand a lot of things of this tutorial BUT i think because i'm begginer on C and saw C++ i may did something wrong. Hope i could help me to find out where i did my mistakes. I think i know where they're but i don't know how to fix it. Please read. Thanks for attention.

C++:
#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 AmmoBaseAddres = {0x009EA0A0};
DWORD AmmoOffsets[] = {0x384, 0x14, 0x0};

// HEALTH VARS

bool HealthStatus;
BYTE HealthValue[] = {0x39, 0x5, 0X0, 0X0};
DWORD HealthBaseAddres = {0x00509B74};
DWORD HealthOffsets[] = {0xF8, 0x14, 0x0};

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(PROCCESS_ALL_ACESS, 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 memory hacker" << std::endl;
			std::cout << "-------------------------------------------" << std::endl << std::endl;
			std::cout << "GAME STATUS: " << GameStatus << std::cout << std::endl;
			std::cout "[F1] Unlimited Ammo ->" <<sAmmoStatus << " <- " std::endl << std::endl;
			std::cout "[F2] Unlimited Health ->" <<sHealthStatus << " <- " std::endl << std::endl;
			std::cout "[INSET] Exit " << std::endl;
			UpdateOnNextRun = false;
			timeSinceLastUpdate = clock ();
		}
		
		if (IsGameAvai){
			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";
			}

			}
		}
	}
	CloseHandle(hProcHandle);
	CloseHandle(hGameWindow);

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

And when i compile show this:

 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,073
78,998
2,371
Basically you have lots of typos. Download the source code from the attachment on the forum and use a file comparison program to compare your file against Fleeps and you will find all your errors
 
L

Lacapod

C++:
#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"; //What the fuck
std::string GameStatus;

bool IsGameAvail;
bool UpdateOnNextRun;

bool AmmoStatus;
BYTE AmmoValue[] = { 0xA3, 0x1C, 0X0, 0X0 };//Just 2 know, as something offtopic, this aint a value
DWORD AmmoBaseAddres = 0x009EA0A0; //Keep this fucking normal, what's up with the godamn brackets?
DWORD AmmoOffsets[] = { 0x384, 0x14, 0x0 };

bool HealthStatus;
BYTE HealthValue[] = { 0x39, 0x5, 0X0, 0X0 };
DWORD HealthBaseAddres = 0x00509B74; //Again the fucking brackets
DWORD HealthOffsets[] = { 0xF8, 0x14, 0x0 };

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, L(GameName)); // Godamn paratheses
			if (hGameWindow) {
				GetWindowThreadProcessId(hGameWindow, &dwProcID);
				if (dwProcID != 0) {
					hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);//You can't spell (or more like read and copy) for shit
					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 memory hacker" << std::endl;
			std::cout << "-------------------------------------------" << std::endl << std::endl;
			std::cout << "GAME STATUS: " << GameStatus;
			std::cout << std::endl;
			std::cout << "[F1] Unlimited Ammo ->" << sAmmoStatus << " <- " << std::endl << std::endl;
			std::cout << "[F2] Unlimited Health ->" << sHealthStatus << " <- " << std::endl << std::endl;
			std::cout << "[INSET] Exit " << std::endl;
			//You missed a bunch of text here, stuff like '<<', '>>'
			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";
				}

		}
	}
	CloseHandle(hProcHandle); //The handle wasn't global
	CloseHandle(hGameWindow); //Same ^ 
	return 0; //What to return outside the int main fuction
}

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, AmmoBaseAddres); //Spelled it wrong ffs
		WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);
	}
	if (HealthStatus) {
		AddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddres); //Spelled it wrong too ffs
		WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &HealthValue, sizeof(HealthValue), NULL);
	}
}
I fixed your idiot fleep c&p cause idfc.
GL at leeching, also, check my few comments maybe they will help making leeching easier for u.
lern 2 write btw
 
Last edited:

erick_sx

Newbie
Dec 19, 2016
2
12
0
Thanks. I'm not familiar as i thought i could be. Sorry by my mistakes - some of them like the Game Window it's like the video guy told to do - but specifically with your language, i'm not fluent. I'll try do my best next time. Thanks guys.
 

PwndDepot

I has a status
Dank Tier VIP
Trump Tier Donator
Dank Tier Donator
Nov 5, 2014
239
7,748
19
I have no idea what u mean lmao, but k
Hey man, we all gotta start somewhere. He's obviously new, there's no need for that here. The name of the site is GUIDED Hacking for a reason.
 
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