❗ aimbot shoot in random point

Posts 1–15 of 15 · Page 1 of 1
❗ aimbot shoot in random point
Code:
void CalcAngle(Vector2 &src, Vector2 &dst, Vector2 &angles)
{
	double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z) };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles.x = (float)(asinf(delta[2] / hyp) * 57.295779513082f);
	angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f);
	angles.z = 0.0f;

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

void SmoothAngles(Vector2 &ang, float smooth) {
	if (smooth > 0) {
		float a_fixAng = ang.y, p_fixAng = MyPlayer.CurrentViewAngles.y, distance = 0;
		if (ang.y < 0) {
			a_fixAng = 360 + ang.y;
		}
		if (MyPlayer.CurrentViewAngles.y < 0) {
			p_fixAng = 360 + MyPlayer.CurrentViewAngles.y;
		}
		distance = min(abs(a_fixAng - p_fixAng), 360 - abs(a_fixAng - p_fixAng));
		if (MyPlayer.CurrentViewAngles.y > 90 && ang.y < -90) {
			ang.x = MyPlayer.CurrentViewAngles.x + (ang.x - MyPlayer.CurrentViewAngles.x) / smooth;
			ang.y = MyPlayer.CurrentViewAngles.y + distance / smooth;
			if (ang.y > 180.f) {
				ang.y = -360 + ang.y;
			}
			return;
		}
		if (MyPlayer.CurrentViewAngles.y < -90 && ang.y > 90) {
			ang.x = MyPlayer.CurrentViewAngles.x + (ang.x - MyPlayer.CurrentViewAngles.x) / smooth;
			ang.y = MyPlayer.CurrentViewAngles.y - distance / smooth;
			if (ang.y < -180.f) {
				ang.y = 360 + ang.y;
			}
			return;
		}
		ang.x = MyPlayer.CurrentViewAngles.x + (ang.x - MyPlayer.CurrentViewAngles.x) / smooth;
		ang.y = MyPlayer.CurrentViewAngles.y + (ang.y - MyPlayer.CurrentViewAngles.y) / smooth;
	}
	return;
}

bool ValidTarget(int vTarget, int vFov) {
	if (vTarget == 0) {
		return false;
	}
	if (vTarget > 32) {
		return false;
	}
	if (PlayerList[vTarget].Team == MyPlayer.Team) {
		return false;
	}
	if (PlayerList[vTarget].isDead) {
		return false;
	}
	if (PlayerList[vTarget].Dormant) {
		return false;
	}
	/*if (!PlayerList[vTarget].Spotted) {
		if (cfg[0].misc.visiblecheck == 1) {
			return false;
		}
	}*/
	if (PlayerList[vTarget].Health <= 0 || PlayerList[vTarget].Health > 100) {
		return false;
	}
	if (vFov <= /*cfg[Player.wn].aimbot.fov*/ 999) {
		return true;
	}
	return false;
}

int BestTarget() {
	int Target = -1;
	float mFov = 360;
	for (int i = 1; i < 32; i++) {
		Vector2 Angles;
		CalcAngle(PlayerList[i].abBonePosition, MyPlayer.Position, Angles);
		float tFov, hAng, vAng, a_fixAng = Angles.y, p_fixAng = MyPlayer.CurrentViewAngles.y;
		vAng = Angles.x - MyPlayer.CurrentViewAngles.x;
		if (Angles.y < 0) {
			a_fixAng = 360 + Angles.y;
		}
		if (MyPlayer.CurrentViewAngles.y < 0) {
			p_fixAng = 360 + MyPlayer.CurrentViewAngles.y;
		}
		hAng = min(abs(a_fixAng - p_fixAng), 360 - abs(a_fixAng - p_fixAng));
		tFov = sqrt(hAng * hAng + vAng * vAng);
		if (tFov < mFov && ValidTarget(i, tFov)) {
			mFov = tFov;
			Target = i;
		}
	}
	return Target;
}

void aimbot() {
	for (;; Sleep(1)) {
		if (GetAsyncKeyState(VK_LBUTTON)) {
			int Target = BestTarget();
			int work = MyPlayer.ShotsFired;
			if (Target != -1) {
				Vector2 Angles;
				Angles.x = MyPlayer.CurrentViewAngles.x;
				Angles.y = MyPlayer.CurrentViewAngles.y;
				Angles.z = 0;
				CalcAngle(PlayerList[Target].abBonePosition, MyPlayer.Position, Angles);
			//	cout << Angles.x << " " << Angles.y << " " << Angles.z << endl;
				SmoothAngles(Angles, 1);
				NormalizeAngle(Angles);
				if (Angles.y < 180.0f && Angles.y > -180.0f && Angles.x < 90.0f && Angles.x > -90.0f) {
					WM<Vector2>(MyPlayer.ClientState + dwViewAngles, Angles);
				}
			}
		}
	}
}
I debug all variables, abbonepositions, player positions etc..
all right but calcangle do rave..
I worked on this for a long time, could u help me please?
show me my mistake, guys.. (waser esser, especially I look forward for your answer)
Could you send me the project via PM?
I'd like to debug it.
WasserEsser, check pm!
why is your smoothing so complicated there are much easier ways
I just wanted to let you know that i found the problem and will write my post now.



EDIT:

Alright, so let's first address the problem.
You're currently calculating an angle between the head bone position of an enemy player and your m_vecOrigin position while the enemies head bone position is the source. That's not how CalcAngle is supposed to be used. CalcAngle calculates an angle by taking the POSITION of your ViewAngles ( not your ViewAngles, the position of them ) and the position of the target ( the head bone position ). The position of your ViewAngles is supposed to be the source while the enemies head bone position is the target.

You can get the position of your ViewAngles by taking your players position ( m_vecOrigin ) and adding m_vecViewOffset ( 0x104 ) onto it. This results into the position of your ViewAngles. Keep in mind that this should be the source ( first parameter, not the second ). Now move the enemies head bone position into the second parameter and you get a correctly calculated angle. But let me show you something.



Notice how this only happens if i'm infront of the enemy? That's because of the quadrants and how angles work differently in each quadrant. To prevent such a thing from happening, you should normalize your angles every time you did any operations with them. But do not use your normalize function, since it also clamps. Clamping in a normalize function is bad, since it will destroy any further calculation if it clamped, even though it shouldn't have clamped. Please seperate your normalize and clamp functions. Your clamp function is also normalizing. There are resources all around the internet about how to normalize and clamp properly.

Apart from that, your smooth and BestTarget functions have such a huge amount of unnecessary math, it's incredible, lol. You can get the FOV like this:

Code:
if ( CalculatedAngle.NormalizeVector( ) )
{
	Vector3 Delta = CalculatedAngle - Engine->GetViewAngle( );

	if ( Delta.NormalizeVector( ) )
	{
		FOV = sqrt( Delta.x * Delta.x + Delta.y * Delta.y );
As you can see, every time i so any operation with a vector, i normalize it. You should do the same. Clamping should only happen right before you set the angle.
This above is not distance based FOV, but simple math ( rule of three ) can sort that out for you.

Smoothing can also be done much much much much easier. The simplest smooth function i can think of if dividing the delta each time. This will result in a faster aiming at the beginning, and the closer you get to the target, the slower the aiming is going to be.

Code:
Vector3 Delta = Engine->GetViewAngle( ) - CalculatedAngle;

if( Delta.NormalizeAngle( ) )
{	
	CalculatedAngle = Engine->GetViewAngle( ) - Delta / SmoothAmount;
	
	if ( CalculatedAngle.NormalizeAngle( ) )
	{
A smoothing amount of 2 would half each delta into 2, which means that it would be the fastest one while a higher smoothing amount would result in slower aiming.
Of course you would have to add the according operator overloads for the above code to work, but you can also do it for each float within the vector.

Also, i'd like to mention that you're reading and writing too much each time you're reading or writing a vector.
Your vector is called Vector2 while it has 4 members, a QAngle ( ViewAngles are defined as QAngle ) has 3 floats, so you're reading and writing 1 float too much.

There are alot more improvements that can be made, but i won't go into those here, as this post here is addressing the problem you had in this thread.


P.S.: You aren't using work, which you declare here:
Code:
int work = MyPlayer.ShotsFired;
Okay, I'm going to think. Now I try to explain all

Quote Originally Posted by WasserEsser View Post
Alright, so let's first address the problem.
You're currently calculating an angle between the head bone position of an enemy player and your m_vecOrigin position while the enemies head bone position is the source. That's not how CalcAngle is supposed to be used. CalcAngle calculates an angle by taking the POSITION of your ViewAngles ( not your ViewAngles, the position of them ) and the position of the target ( the head bone position ). The position of your ViewAngles is supposed to be the source while the enemies head bone position is the target.
i fix it.
Code:
CalcAngle(MyPlayer.Position, PlayerList[Target].abBonePosition, Angles, 1);
Quote Originally Posted by WasserEsser View Post
You can get the position of your ViewAngles by taking your players position ( m_vecOrigin ) and adding m_vecViewOffset ( 0x104 ) onto it. This results into the position of your ViewAngles. Keep in mind that this should be the source ( first parameter, not the second ). Now move the enemies head bone position into the second parameter and you get a correctly calculated angle. But let me show you something.
if I understand you correctly, I should do it:
Code:
AnglePosition = RM<Vector>(Base + dwVecOrigin + dwVecViewOffset);
and put it in calc angle:
Code:
CalcAngle(MyPlayer.AnglePosition, PlayerList[Target].abBonePosition, Angles, 1);
but if i do it, it aim in random point.

[/QUOTE]

[QUOTE=WasserEsser;11744408]


Notice how this only happens if i'm infront of the enemy? That's because of the quadrants and how angles work differently in each quadrant. To prevent such a thing from happening, you should normalize your angles every time you did any operations with them. But do not use your normalize function, since it also clamps. Clamping in a normalize function is bad, since it will destroy any further calculation if it clamped, even though it shouldn't have clamped. Please seperate your normalize and clamp functions. Your clamp function is also normalizing. There are resources all around the internet about how to normalize and clamp properly.
/[QUOTE]
Now my Clamp function is:
Code:
void ClampAngles(Vector &angles)
{

	if (angles.x > 89)  { angles.x = 89; }
	if (angles.x < -89) { angles.x = -89; }
	if (angles.y > 180) { angles.y = 180; }
	if (angles.y < -180) { angles.y = -180; } 
	angles.z = 0;
}
and Normalize func. is:
Code:
void NormalizeAngle(Vector &angles)
{
	if (angles.y > 180.f)						{ angles.y -= 360.f; }
	if (angles.y < -180.f)						{ angles.y += 360.f; }
	if (angles.z != 0.0f)						{ angles.z = 0.0f; }
}
Quote Originally Posted by WasserEsser View Post
Apart from that, your smooth and BestTarget functions have such a huge amount of unnecessary math, it's incredible, lol. You can get the FOV like this:

Code:
if ( CalculatedAngle.NormalizeVector( ) )
{
	Vector3 Delta = CalculatedAngle - Engine->GetViewAngle( );

	if ( Delta.NormalizeVector( ) )
	{
		FOV = sqrt( Delta.x * Delta.x + Delta.y * Delta.y );
As you can see, every time i so any operation with a vector, i normalize it. You should do the same. Clamping should only happen right before you set the angle.
This above is not distance based FOV, but simple math ( rule of three ) can sort that out for you.
How can i do it?
Vector delta = calc angle - getview, okay, but i need to use fov before calculating!
i need to choose best target and calculate coordinates for current target, but how i can create getfov function without calculating?


Quote Originally Posted by WasserEsser View Post
Smoothing can also be done much much much much easier. The simplest smooth function i can think of if dividing the delta each time. This will result in a faster aiming at the beginning, and the closer you get to the target, the slower the aiming is going to be.

Code:
Vector3 Delta = Engine->GetViewAngle( ) - CalculatedAngle;

if( Delta.NormalizeAngle( ) )
{	
	CalculatedAngle = Engine->GetViewAngle( ) - Delta / SmoothAmount;
	
	if ( CalculatedAngle.NormalizeAngle( ) )
	{
A smoothing amount of 2 would half each delta into 2, which means that it would be the fastest one while a higher smoothing amount would result in slower aiming.
Of course you would have to add the according operator overloads for the above code to work, but you can also do it for each float within the vector.
Succ. done.


Quote Originally Posted by WasserEsser View Post
Also, i'd like to mention that you're reading and writing too much each time you're reading or writing a vector.
Your vector is called Vector2 while it has 4 members, a QAngle ( ViewAngles are defined as QAngle ) has 3 floats, so you're reading and writing 1 float too much.
fixed.

Quote Originally Posted by WasserEsser View Post
There are alot more improvements that can be made, but i won't go into those here, as this post here is addressing the problem you had in this thread.

P.S.: You aren't using work, which you declare here:
Code:
int work = MyPlayer.ShotsFired;
i deleted it.

Quote Originally Posted by WasserEsser View Post

Quote Originally Posted by SP1K3CSGO View Post
Code:
CalcAngle(MyPlayer.Position, PlayerList[Target].abBonePosition, Angles, 1);
if I understand you correctly, I should do it:
Code:
AnglePosition = RM<Vector>(Base + dwVecOrigin + dwVecViewOffset);
and put it in calc angle:
Code:
CalcAngle(MyPlayer.AnglePosition, PlayerList[Target].abBonePosition, Angles, 1);
but if i do it, it aim in random point.
Yes, you aim at a random point because adding offsets is not what you are supposed to do, you are supposed to read m_vecOrigin and m_vecViewOffset seperately and add the Vectors together.

Quote Originally Posted by SP1K3CSGO View Post
Vector delta = calc angle - getview, okay, but i need to use fov before calculating!
i need to choose best target and calculate coordinates for current target, but how i can create getfov function without calculating?
I don't get your problem? What i showed you is how to calculate how far away the current entity in your loop is away from your crosshair. You don't need FOV for CalcAngle.


When i said you aren't doing what i told you to do, i was talking about my last post, which was addressing your new problem.

You aren't doing what i told you there. You are not normalizing anything other than the angle you're going to use. You are supposed to normalize every delta you calculate, everything.
Quote Originally Posted by WasserEsser View Post
Yes, you aim at a random point because adding offsets is not what you are supposed to do, you are supposed to read m_vecOrigin and m_vecViewOffset seperately and add the Vectors together.
Oh, it fix one of troubles.
Now calc angles looks like:
Code:
				Vector CalcAngles, MyAnglesPos;

				CalcAngles.x = MyPlayer.CurrentViewAngles.x;
				CalcAngles.y = MyPlayer.CurrentViewAngles.y;
				CalcAngles.z = 0;
				NormalizeAngle(CalcAngles);

				MyAnglesPos.x = MyPlayer.AnglePosition.x + MyPlayer.Position.x;
				MyAnglesPos.y = MyPlayer.AnglePosition.y + MyPlayer.Position.y;
				MyAnglesPos.z = MyPlayer.AnglePosition.z + MyPlayer.Position.z;

				CalcAngle(MyAnglesPos, PlayerList[Target].abBonePosition, CalcAngles, 1);
And it work so nice.

Quote Originally Posted by WasserEsser View Post
I don't get your problem? What i showed you is how to calculate how far away the current entity in your loop is away from your crosshair. You don't need FOV for CalcAngle.
What i need to count FOV? I need *CALCULATED ANGLES*, but i need to put GETFOV in BestTarget to compare it in ValidTarget!
I need to calc FOV BEFORE CALCULATING ANGLES!






I do nt know what to do with dat.

When i said you aren't doing what i told you to do, i was talking about my last post, which was addressing your new problem.
Okay, I normalized all manipulations with angles.[/QUOTE]
Okay, now most of the bugs have been fixed. and i have a new trouble.
Code:
void NormalizeAngle(Vector &angles)
{
	if (angles.x > 89.0f && angles.x <= 180.0f) { angles.x = 89.0f;  }
	if (angles.x > 180.f)						{ angles.x -= 360.f; }
	if (angles.x < -89.0f)						{ angles.x = -89.0f; }
	if (angles.y > 180.f)						{ angles.y -= 360.f; }
	if (angles.y < -180.f)						{ angles.y += 360.f; }
	if (angles.z != 0.0f)						{ angles.z = 0.0f;   }
}

void ClampAngles(Vector &angles)
{
	if (angles.x > 89)		{ angles.x = 89;   }
	if (angles.x < -89)		{ angles.x = -89;  }
	if (angles.y > 180)		{ angles.y = 180;  }
	if (angles.y < -180)	{ angles.y = -180; }
	if (angles.z != 0)		{ angles.z = 0;    }
}
void CalcAngle(Vector &src, Vector &dst, Vector &angles, int rcs)
{
	int Value;
	switch (MyPlayer.Flags) {
	case 257: { Value = 64.07; break; }
	case 263: { Value = 44.05; break; }
	}
	double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z + Value) };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles.x = (float)(asinf(delta[2] / hyp) * 57.295779513082f) - MyPlayer.Punch.x * 2.0f * rcs;
	angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f) - MyPlayer.Punch.y * 2.0f * rcs;
	angles.z = 0;
	if (delta[0] >= 0.0) { angles.y += 180.0f; }
}

void SmoothAngles(Vector &ang, float smooth) {
	ang.x = MyPlayer.CurrentViewAngles.x - (MyPlayer.CurrentViewAngles.x - ang.x) / smooth;
	ang.y = MyPlayer.CurrentViewAngles.y - (MyPlayer.CurrentViewAngles.y - ang.y) / smooth;
}

float Get3dDistance(Vector myCoords, Vector enemyCoords)
{
	return sqrt(
		pow(double(enemyCoords.x - myCoords.x), 2.0) +
		pow(double(enemyCoords.y - myCoords.y), 2.0) +
		pow(double(enemyCoords.z - myCoords.z), 2.0));
}

bool ValidTarget(int vTarget, int vFov) {
	if (vTarget == 0)								
		return false;
	if (vTarget > 32)								
		return false;
	if (PlayerList[vTarget].Team == MyPlayer.Team)	
		return false;
	if (PlayerList[vTarget].isDead)					
		return false;
//	if (PlayerList[vTarget].Dormant)				
//*		return false;
	if (!PlayerList[vTarget].Spotted)				
		return false;
	if (PlayerList[vTarget].Health <= 0 || PlayerList[vTarget].Health > 100) 
		return false;
	if (vFov <= 999999999)						
		return true;
	return false;
}

int BestTarget() {
	int Target = -1;
	int MaxDist = 1000000;
	for (int i = 1; i < 32; i++) {
		PlayerList[i].ReadInformation(i);
		Vector Angles, Delta;
		double distance = Get3dDistance(PlayerList[i].abBonePosition, MyPlayer.Position), FOV;
		CalcAngle(PlayerList[i].abBonePosition, MyPlayer.Position, Angles, 1);

		Delta.x = Angles.x - MyPlayer.CurrentViewAngles.x;
		Delta.y = Angles.y - MyPlayer.CurrentViewAngles.y;
		FOV = sqrt(Delta.x * Delta.x + Delta.y * Delta.y);

		if (distance < MaxDist && ValidTarget(i, FOV)) {
			MaxDist = distance;
			Target = i;
		//	cout << FOV << endl;
		}
	}
	return Target;
}


void aimbot() {
	for (;; Sleep(1)) {
		if (GetAsyncKeyState(VK_LBUTTON) &&  RFI.AimBot) {
			int Target = BestTarget();
			if (Target != -1) {
				Vector Angles;

				Angles.x = MyPlayer.CurrentViewAngles.x;
				Angles.y = MyPlayer.CurrentViewAngles.y;
				Angles.z = 0;

				CalcAngle(MyPlayer.Position, PlayerList[Target].abBonePosition, Angles, 1);
				SmoothAngles(Angles, RFI.AimBotSmooth);
				ClampAngles(Angles);
				NormalizeAngle(Angles);

				if (Angles.y < 180.0f && Angles.y > -180.0f && Angles.x < 90.0f && Angles.x > -90.0f)
					WM<Vector>(MyPlayer.ClientState + dwViewAngles, Angles);
				Sleep(7);
			}
		}
	}
}
Here is my source. Whats the trouble?
it moves wrong. for example: my viewangle.y position is -170 and enemy is 170. aimbot turn 360 degrees instead go to 20 coordinates and draw a straight line to enemy. it caused due clamp angles + normalize angle +
if (Angles.y < 180.0f && Angles.y > -180.0f && Angles.x < 90.0f && Angles.x > -90.0f)
how to get aimbot to hold a straight line?

- - - Updated - - -

i need to say big russian thanks to wasser esser for help
Quote Originally Posted by SP1K3CSGO View Post
Okay, now most of the bugs have been fixed. and i have a new trouble.
Code:
void NormalizeAngle(Vector &angles)
{
	if (angles.x > 89.0f && angles.x <= 180.0f) { angles.x = 89.0f;  }
	if (angles.x > 180.f)						{ angles.x -= 360.f; }
	if (angles.x < -89.0f)						{ angles.x = -89.0f; }
	if (angles.y > 180.f)						{ angles.y -= 360.f; }
	if (angles.y < -180.f)						{ angles.y += 360.f; }
	if (angles.z != 0.0f)						{ angles.z = 0.0f;   }
}

void ClampAngles(Vector &angles)
{
	if (angles.x > 89)		{ angles.x = 89;   }
	if (angles.x < -89)		{ angles.x = -89;  }
	if (angles.y > 180)		{ angles.y = 180;  }
	if (angles.y < -180)	{ angles.y = -180; }
	if (angles.z != 0)		{ angles.z = 0;    }
}
void CalcAngle(Vector &src, Vector &dst, Vector &angles, int rcs)
{
	int Value;
	switch (MyPlayer.Flags) {
	case 257: { Value = 64.07; break; }
	case 263: { Value = 44.05; break; }
	}
	double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z + Value) };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles.x = (float)(asinf(delta[2] / hyp) * 57.295779513082f) - MyPlayer.Punch.x * 2.0f * rcs;
	angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f) - MyPlayer.Punch.y * 2.0f * rcs;
	angles.z = 0;
	if (delta[0] >= 0.0) { angles.y += 180.0f; }
}

void SmoothAngles(Vector &ang, float smooth) {
	ang.x = MyPlayer.CurrentViewAngles.x - (MyPlayer.CurrentViewAngles.x - ang.x) / smooth;
	ang.y = MyPlayer.CurrentViewAngles.y - (MyPlayer.CurrentViewAngles.y - ang.y) / smooth;
}

float Get3dDistance(Vector myCoords, Vector enemyCoords)
{
	return sqrt(
		pow(double(enemyCoords.x - myCoords.x), 2.0) +
		pow(double(enemyCoords.y - myCoords.y), 2.0) +
		pow(double(enemyCoords.z - myCoords.z), 2.0));
}

bool ValidTarget(int vTarget, int vFov) {
	if (vTarget == 0)								
		return false;
	if (vTarget > 32)								
		return false;
	if (PlayerList[vTarget].Team == MyPlayer.Team)	
		return false;
	if (PlayerList[vTarget].isDead)					
		return false;
//	if (PlayerList[vTarget].Dormant)				
//*		return false;
	if (!PlayerList[vTarget].Spotted)				
		return false;
	if (PlayerList[vTarget].Health <= 0 || PlayerList[vTarget].Health > 100) 
		return false;
	if (vFov <= 999999999)						
		return true;
	return false;
}

int BestTarget() {
	int Target = -1;
	int MaxDist = 1000000;
	for (int i = 1; i < 32; i++) {
		PlayerList[i].ReadInformation(i);
		Vector Angles, Delta;
		double distance = Get3dDistance(PlayerList[i].abBonePosition, MyPlayer.Position), FOV;
		CalcAngle(PlayerList[i].abBonePosition, MyPlayer.Position, Angles, 1);

		Delta.x = Angles.x - MyPlayer.CurrentViewAngles.x;
		Delta.y = Angles.y - MyPlayer.CurrentViewAngles.y;
		FOV = sqrt(Delta.x * Delta.x + Delta.y * Delta.y);

		if (distance < MaxDist && ValidTarget(i, FOV)) {
			MaxDist = distance;
			Target = i;
		//	cout << FOV << endl;
		}
	}
	return Target;
}


void aimbot() {
	for (;; Sleep(1)) {
		if (GetAsyncKeyState(VK_LBUTTON) &&  RFI.AimBot) {
			int Target = BestTarget();
			if (Target != -1) {
				Vector Angles;

				Angles.x = MyPlayer.CurrentViewAngles.x;
				Angles.y = MyPlayer.CurrentViewAngles.y;
				Angles.z = 0;

				CalcAngle(MyPlayer.Position, PlayerList[Target].abBonePosition, Angles, 1);
				SmoothAngles(Angles, RFI.AimBotSmooth);
				ClampAngles(Angles);
				NormalizeAngle(Angles);

				if (Angles.y < 180.0f && Angles.y > -180.0f && Angles.x < 90.0f && Angles.x > -90.0f)
					WM<Vector>(MyPlayer.ClientState + dwViewAngles, Angles);
				Sleep(7);
			}
		}
	}
}
Here is my source. Whats the trouble?
it moves wrong. for example: my viewangle.y position is -170 and enemy is 170. aimbot turn 360 degrees instead go to 20 coordinates and draw a straight line to enemy. it caused due clamp angles + normalize angle +
how to get aimbot to hold a straight line?

- - - Updated - - -

i need to say big russian thanks to wasser esser for help
Like i said before, you are supposed to normalize each angle you're using. You aren't normalizing your smooth angles nor do you normalize your FOV angles after you did operations with them.

Also, your normalize function is still clamping while your clamp function is also clamping your y values.

Also, if you're doing 360 turns, exchange your if statements within your normalize function for your y values to while loops.

Also, you are still calculating a wrong angle within your BestTarget function. ( still bone to your feet, it should be the other way around ).

Also stop doing that shitty calcangle switch case stuff, just do MyPlayer.Position + m_vecViewOffset as i said above.
wasser esser..
I spent on it for more than five hours. maybe I'm not able to bring it to mind..
Code:
void NormalizeAngle(Vector &angles)
{
	if (angles.x > 89.0f && angles.x <= 180.0f) { angles.x = 89.0f; }
	if (angles.x > 180.f)						{ angles.x -= 360.f; }
	if (angles.x < -89.0f)						{ angles.x = -89.0f; }
	if (angles.y > 180.f)						{ angles.y -= 360.f; }
	if (angles.y < -180.f)						{ angles.y += 360.f; }
	if (angles.z != 0.0f)						{ angles.z = 0.0f; }
}

void ClampAngles(Vector &angles)
{
	if (angles.x > 89)		{ angles.x = 89; }
	if (angles.x < -89)		{ angles.x = -89; }
	if (angles.y > 180)		{ angles.y = 180; }
	if (angles.y < -180)	{ angles.y = -180; }
	if (angles.z != 0)		{ angles.z = 0; }
}

/*void Stable(Vector &angles)
{
	if (MyPlayer.CurrentViewAngles.y > 0.0f && angles.y > 180.0f) { 
		Vector calcangles;
		calcangles.y = angles.y;
		calcangles.y *= -1;
		angles.y = -180.0f; 
		float value = calcangles.y + 180.0f;
		value *= -1;
		angles.y += value;
	}
}*/

void CalcAngle(Vector &src, Vector &dst, Vector &angles, int rcs)
{
	int Value;
	switch (MyPlayer.Flags) {
	case 257: { Value = 64.07; break; }
	case 263: { Value = 44.05; break; }
	}
	double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z + Value) };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles.x = (float)(asinf(delta[2] / hyp) * 57.295779513082f) - MyPlayer.Punch.x * 2.0f * rcs;
	angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f) - MyPlayer.Punch.y * 2.0f * rcs;
	angles.z = 0;

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

void SmoothAngles(Vector &angles, float smooth) {
	angles.x = MyPlayer.CurrentViewAngles.x - (MyPlayer.CurrentViewAngles.x - angles.x) / smooth;
	angles.y = MyPlayer.CurrentViewAngles.y - (MyPlayer.CurrentViewAngles.y - angles.y) / smooth;
}

float Get3dDistance(Vector myCoords, Vector enemyCoords)
{
	return sqrt(
		pow(double(enemyCoords.x - myCoords.x), 2.0) +
		pow(double(enemyCoords.y - myCoords.y), 2.0) +
		pow(double(enemyCoords.z - myCoords.z), 2.0));
}

bool ValidTarget(int vTarget, int vFov) {
	if (vTarget == 0)
		return false;
	if (vTarget > 32)
		return false;
	if (PlayerList[vTarget].Team == MyPlayer.Team)
		return false;
	if (PlayerList[vTarget].isDead)
		return false;
	//	if (PlayerList[vTarget].Dormant)				
	//*		return false;
	if (!PlayerList[vTarget].Spotted)
		return false;
	if (PlayerList[vTarget].Health <= 0 || PlayerList[vTarget].Health > 100)
		return false;
	if (vFov <= 999999999)
		return true;
	return false;
}

int BestTarget() {
	int Target = -1;
	int MaxDist = 1000000;
	for (int i = 1; i < 32; i++) {
		PlayerList[i].ReadInformation(i);
		double distance = Get3dDistance(PlayerList[i].abBonePosition, MyPlayer.Position), FOV;
		FOV = sqrt(MyPlayer.CurrentViewAngles.x * MyPlayer.CurrentViewAngles.x + MyPlayer.CurrentViewAngles.y * MyPlayer.CurrentViewAngles.y);
		if (distance < MaxDist && ValidTarget(i, FOV)) {
			MaxDist = distance;
			Target = i;
		}
	}
	return Target;
}


void aimbot() {
	for (;; Sleep(1)) {
		if (GetAsyncKeyState(VK_LBUTTON) && RFI.AimBot) {
			int Target = BestTarget();
			if (Target != -1) {
				Vector Angles;

				Angles.x = MyPlayer.CurrentViewAngles.x;
				Angles.y = MyPlayer.CurrentViewAngles.y;
				Angles.z = 0;

				CalcAngle(MyPlayer.Position, PlayerList[Target].abBonePosition, Angles, 1);
				NormalizeAngle(Angles);
				SmoothAngles(Angles, RFI.AimBotSmooth);
				NormalizeAngle(Angles);
				ClampAngles(Angles);
				NormalizeAngle(Angles);

				if (Angles.y < 180.0 && Angles.y > -180.0 && Angles.x < 90.0 && Angles.x > -90.0)
					WM<Vector>(MyPlayer.ClientState + dwViewAngles, Angles);
				Sleep(7);
			}
		}
	}
}
the problem persists.
it spin 360 when my viewangle > 0 and bone pos < 0. it happend when smooth angles is active.
i dont know how to fix it. I'm an inexperienced programmer. I am already tired of that any fix. I leave the source here, maybe somebody else will do it for yourself.
Quote Originally Posted by SP1K3CSGO View Post
wasser esser..
I spent on it for more than five hours. maybe I'm not able to bring it to mind..
Code:
void NormalizeAngle(Vector &angles)
{
	if (angles.x > 89.0f && angles.x <= 180.0f) { angles.x = 89.0f; }
	if (angles.x > 180.f)						{ angles.x -= 360.f; }
	if (angles.x < -89.0f)						{ angles.x = -89.0f; }
	if (angles.y > 180.f)						{ angles.y -= 360.f; }
	if (angles.y < -180.f)						{ angles.y += 360.f; }
	if (angles.z != 0.0f)						{ angles.z = 0.0f; }
}

void ClampAngles(Vector &angles)
{
	if (angles.x > 89)		{ angles.x = 89; }
	if (angles.x < -89)		{ angles.x = -89; }
	if (angles.y > 180)		{ angles.y = 180; }
	if (angles.y < -180)	{ angles.y = -180; }
	if (angles.z != 0)		{ angles.z = 0; }
}

/*void Stable(Vector &angles)
{
	if (MyPlayer.CurrentViewAngles.y > 0.0f && angles.y > 180.0f) { 
		Vector calcangles;
		calcangles.y = angles.y;
		calcangles.y *= -1;
		angles.y = -180.0f; 
		float value = calcangles.y + 180.0f;
		value *= -1;
		angles.y += value;
	}
}*/

void CalcAngle(Vector &src, Vector &dst, Vector &angles, int rcs)
{
	int Value;
	switch (MyPlayer.Flags) {
	case 257: { Value = 64.07; break; }
	case 263: { Value = 44.05; break; }
	}
	double delta[3] = { (src.x - dst.x), (src.y - dst.y), (src.z - dst.z + Value) };
	double hyp = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
	angles.x = (float)(asinf(delta[2] / hyp) * 57.295779513082f) - MyPlayer.Punch.x * 2.0f * rcs;
	angles.y = (float)(atanf(delta[1] / delta[0]) * 57.295779513082f) - MyPlayer.Punch.y * 2.0f * rcs;
	angles.z = 0;

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

void SmoothAngles(Vector &angles, float smooth) {
	angles.x = MyPlayer.CurrentViewAngles.x - (MyPlayer.CurrentViewAngles.x - angles.x) / smooth;
	angles.y = MyPlayer.CurrentViewAngles.y - (MyPlayer.CurrentViewAngles.y - angles.y) / smooth;
}

float Get3dDistance(Vector myCoords, Vector enemyCoords)
{
	return sqrt(
		pow(double(enemyCoords.x - myCoords.x), 2.0) +
		pow(double(enemyCoords.y - myCoords.y), 2.0) +
		pow(double(enemyCoords.z - myCoords.z), 2.0));
}

bool ValidTarget(int vTarget, int vFov) {
	if (vTarget == 0)
		return false;
	if (vTarget > 32)
		return false;
	if (PlayerList[vTarget].Team == MyPlayer.Team)
		return false;
	if (PlayerList[vTarget].isDead)
		return false;
	//	if (PlayerList[vTarget].Dormant)				
	//*		return false;
	if (!PlayerList[vTarget].Spotted)
		return false;
	if (PlayerList[vTarget].Health <= 0 || PlayerList[vTarget].Health > 100)
		return false;
	if (vFov <= 999999999)
		return true;
	return false;
}

int BestTarget() {
	int Target = -1;
	int MaxDist = 1000000;
	for (int i = 1; i < 32; i++) {
		PlayerList[i].ReadInformation(i);
		double distance = Get3dDistance(PlayerList[i].abBonePosition, MyPlayer.Position), FOV;
		FOV = sqrt(MyPlayer.CurrentViewAngles.x * MyPlayer.CurrentViewAngles.x + MyPlayer.CurrentViewAngles.y * MyPlayer.CurrentViewAngles.y);
		if (distance < MaxDist && ValidTarget(i, FOV)) {
			MaxDist = distance;
			Target = i;
		}
	}
	return Target;
}


void aimbot() {
	for (;; Sleep(1)) {
		if (GetAsyncKeyState(VK_LBUTTON) && RFI.AimBot) {
			int Target = BestTarget();
			if (Target != -1) {
				Vector Angles;

				Angles.x = MyPlayer.CurrentViewAngles.x;
				Angles.y = MyPlayer.CurrentViewAngles.y;
				Angles.z = 0;

				CalcAngle(MyPlayer.Position, PlayerList[Target].abBonePosition, Angles, 1);
				NormalizeAngle(Angles);
				SmoothAngles(Angles, RFI.AimBotSmooth);
				NormalizeAngle(Angles);
				ClampAngles(Angles);
				NormalizeAngle(Angles);

				if (Angles.y < 180.0 && Angles.y > -180.0 && Angles.x < 90.0 && Angles.x > -90.0)
					WM<Vector>(MyPlayer.ClientState + dwViewAngles, Angles);
				Sleep(7);
			}
		}
	}
}
the problem persists.
it spin 360 when my viewangle > 0 and bone pos < 0. it happend when smooth angles is active.
i dont know how to fix it. I'm an inexperienced programmer. I am already tired of that any fix. I leave the source here, maybe somebody else will do it for yourself.
You simply haven't done what i said.
You did nothing i said above, the only thing you changed is that you aren't using CalcAngle in your BestTarget function anymore, instead you do a completely pointless "FOV calculation", which has nothing to do with calculating the FOV.

Code:
FOV = sqrt(MyPlayer.CurrentViewAngles.x * MyPlayer.CurrentViewAngles.x + MyPlayer.CurrentViewAngles.y * MyPlayer.CurrentViewAngles.y);
Normalize_all_of_your_angles_once_you_do_any_calcu lation_with_them.
Code:
CalcAngles.x = MyPlayer.CurrentViewAngles.x;
CalcAngles.y = MyPlayer.CurrentViewAngles.y;
CalcAngles.z = 0;
NormalizeAngle(CalcAngles);
is useless since you do nothing with it, you overwrite it in CalcAngle afterwards.

What i need to count FOV? I need *CALCULATED ANGLES*, but i need to put GETFOV in BestTarget to compare it in ValidTarget!
I need to calc FOV BEFORE CALCULATING ANGLES!
wat. No you don't. First of all you could calculate angles in best target, calculate the FOV, and calculate the final angle once you found the closest target, secondly, you are only comparing if FOV is less or equal to 999999999, you could literally just remove that unnecessary check. Why would you use FOV anyways if you're comparing based on 3d distance? You aren't even getting the target by distance to crosshair, you are getting the best target based on who is the closest one to you. Despite the fact that calculating the best target based on 3d distance is a bad idea, if you use the 3d distance, you don't need FOV at all.

You are still not normalizing everything.
EVERY CALCULATION. EVERYWHERE you see a + / - / / / * sign, normalize. In the code you just showed, you aren't normalizing delta in your GetFOV function. I don't see the other code, so i can't tell anything about that.

I also said you should use while loops within your NormalizeAngle function.
Thank you for trying to help me, but my stupid head is not able bugs.
/solved n closed.
/Solved & closed.
Posts 1–15 of 15 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us