Solved C++ Aimbot (from Fleep's TuT) not working

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

misq

Newbie
Full Member
Aug 8, 2014
10
388
0
C++:
#include <Windows.h>
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
#include "HackProcess.h"

CHackProcess fProcess;
using namespace std;

#define KP_END 0x23
#define RIGHT_MOUSE 0x02

int NumOfPlayers = 32;
const DWORD PlayerCountOff = 0x7D7C80;

const DWORD PlayerBase = 0xA74CDC;
const DWORD EntityBase = 0x4A16C14;
const DWORD EntityLoopDistance = 0x10;

const DWORD TeamOffset = 0xF0;
const DWORD HealthOffset = 0xFC;
const DWORD PosOffset = 0x134;
const DWORD angRotOffset = 0x4CE0;

struct MyPlayer_t
{
	DWORD CLocalPlayer;
	int Team;
	int Health;
	float Position[3];

	void ReadInformation()
	{
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + PlayerBase), &CLocalPlayer, sizeof(DWORD), 0);
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + TeamOffset), &Team, sizeof(int), 0);
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + HealthOffset), &Health, sizeof(int), 0);
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CLocalPlayer + PosOffset), &Position, sizeof(float[3]), 0);

		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + PlayerCountOff), &NumOfPlayers, sizeof(int), 0);
	}
}MyPlayer;

struct TargetList_t
{
	float Distance;
	float AimbotAngle[3];

	TargetList_t()
	{
	}

	TargetList_t(float aimbotAngle[], float myCoords[], float enemyCoords[])
	{
		Distance = Get3Ddistance(myCoords[0], myCoords[1], myCoords[2],
				enemyCoords[0], enemyCoords[1], enemyCoords[2]);

		AimbotAngle[0] = aimbotAngle[0];
		AimbotAngle[1] = aimbotAngle[1];
		AimbotAngle[2] = aimbotAngle[2];
	}

	float Get3Ddistance(float myCoordsX, float myCoordsZ, float myCoordsY,
						float enX, float enZ, float enY)
	{
		return sqrt(pow(double(enX - myCoordsX), 2.0) +
					pow(double(enY - myCoordsY), 2.0) +
					pow(double(enZ - myCoordsZ), 2.0));
	}
};

struct PlayerList_t
{
	DWORD CBaseEntity;
	int Team;
	int Health;
	float Position[3];
	float AimbotAngle[3];

	void ReadInformation(int Player)
	{
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + EntityBase + (Player * EntityLoopDistance)), &CBaseEntity, sizeof(DWORD), 0);
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + TeamOffset), &Team, sizeof(int), 0);
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + HealthOffset), &Health, sizeof(int), 0);
		ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(CBaseEntity + PosOffset), &Position, sizeof(float[3]), 0);
	}
}PlayerList[32];

struct CompareTargetEnArray
{
	bool operator () (TargetList_t & lhs, TargetList_t & rhs)
	{
		return lhs.Distance < rhs.Distance;
	}
};

void CalcAngle(float *src, float *dst, float *angles)
{
	double delta[3] = { (src[0] - dst[0]), (src[1] - dst[1]), (src[2] - dst[2]) };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles[0] = (float)(asinf(delta[2] / hyp) * 57.295779513082f);
	angles[1] = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f);
	angles[2] = 0;

	if (delta[0] >= 0.0)
	{
		angles[1] += 180.0f;
	}
}

void Aimbot()
{
	TargetList_t * TargetList = new TargetList_t[NumOfPlayers];
	int targetLoop = 0;
	for (int i = 0; i < NumOfPlayers; i++)
	{
		PlayerList[i].ReadInformation(i);
		if (PlayerList[i].Team == MyPlayer.Team)
			continue;
		if (PlayerList[i].Health < 2)
			continue;
		CalcAngle(MyPlayer.Position, PlayerList[i].Position, PlayerList[i].AimbotAngle);

		TargetList[targetLoop] = TargetList_t(PlayerList[i].AimbotAngle, MyPlayer.Position, PlayerList[i].Position);

		targetLoop++;
	}

	if (targetLoop > 0)
	{
		std::sort(TargetList, TargetList + targetLoop, CompareTargetEnArray());
		if (GetAsyncKeyState(RIGHT_MOUSE))
		{
			WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordEngine + angRotOffset), TargetList[0].AimbotAngle, 12, 0);
		}
	}
	targetLoop = 0;
	delete[] TargetList;
}

int main()
{
	fProcess.RunProcess();
	cout << "Game found... Running Aimbot..." << endl;
	while (!GetAsyncKeyState(KP_END))
	{
		MyPlayer.ReadInformation();
		Aimbot();
	}

}
Hmm, idk why it isn't working :c mb i forgot about sth
Anyone can help me?)
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,104
12,593
51
You can help yourself in outputting what certain functions return, like ReadProcessMemory, and your process stuff, also your targeting, e.g. if there's a nearest found, how far it is and what the address is.

If there's something weird you'll notice.
 
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