Source Code External Hack Structure (organization)

  • Thread starter wtlyons
  • Start date
  • Replies 3
  • Views 1K
Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat
W

wtlyons

A little code for the community. I wrote this in 15 minutes and didn't really test it or start anything with it yet. It is a very simple structure for external hacks for assault cube. It is clean and meant for you to put your hacks into functions that you pass in hProcHandle into and use your class of offsets and pointers to stay organized and make very readable code. You can create an object staticOffsets offset, then when you need an offset just type offset.health. How easy is that to read? Very! Just some ideas. Also why check the handle everytime through your hack, just make a function where you pass hProcHande into and it checks it. This way you don't create a new handle and check it every 100 milliseconds like fleeps hacks, just check the handle in when you want to! Stay organized and happy hacking! (ps. everyone has different methods for storing their offsets and data. This is just an idea for people to think about and is only 1 out of the thousands of other options there are)

C++:
#include <iostream>
#include <Windows.h>
#include <string>
#include <ctime>
#include <cmath>
HANDLE getHandle();


class staticPointers
{
public:
	DWORD pLocalPlayer = 0x509B74;
	DWORD pEnemyArray = 0x50F4F8;
};

class staticOffsets
{
public:
	DWORD xPos = 0x34;
	DWORD yPos = 0x38;
	DWORD zPos = 0x3C;
	DWORD rotationLR = 0x40;
	DWORD rotationUD = 0x44;
	DWORD health = 0xF8;
	DWORD assaultRifle = 0x150;
	DWORD pistol = 0x13C;
	DWORD grenade = 0x158;
};



int main()
{
	staticPointers pointer;
	staticOffsets offset;
	HANDLE hProcHandle = getHandle();	//get handle to game 
	while (!GetAsyncKeyState(VK_INSERT))
	{

	}

	CloseHandle(hProcHandle);

}







HANDLE getHandle()	//gets handle to the game
{
	HWND hGameWindow = NULL;
	DWORD dwProcID = NULL;
	HANDLE hProcHandle = NULL;

			hGameWindow = FindWindowA(NULL, "AssaultCube");
			if (hGameWindow)
			{
				dwProcID = 0;
				GetWindowThreadProcessId(hGameWindow, &dwProcID);
				if (dwProcID != 0)
				{
					if (hProcHandle != NULL)
					{
						CloseHandle(hProcHandle);
					}
					hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
				}
			}
		
	return hProcHandle;

}
 

Solaire

Respected Hacker
Dank Tier VIP
Dec 15, 2013
1,051
16,353
62
Just a few tips:
Instead of using classes, just use an enum, or better yet a namespace.

C++:
namespace Offsets {
    // Place offset vars here
}

// In code
int healthAddy = localPlayerObject + Offsets::Health;
You also do not use iostream, cmath, ctime, or string so they aren't needed.

Your GrabHandle function can be reduced to just a few lines that are way more readable:

C++:
HANDLE GrabHandle(char * windowName) {
    HWND windHandle = FindWindow(windowName);
    DWORD pid;
    GetWindowThreadProcessId(windHandle, &pid);
    return OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
}
Anywho, thanks for sharing man! Keep on learning :D
 
W

wtlyons

I just jacked it out of my code and I was using those libraries and I prefer classes over making everything a namespace:p
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,745
40,528
316
Those classes will be inlined/optimised anyway.
 
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