EDIT: SOLVED.
For anyone else wanting a solution, here:
Code:
double GetDistanceToAngle(Vector3 AimAt, Vector3 CurrentAngle)
{
	AimAt.y += 180.f;
	CurrentAngle.y += 180.f;
	CurrentAngle.x += 90.f;
	AimAt.x += 90.f;
	float YDiff = max(AimAt.y, CurrentAngle.y) - min(AimAt.y, CurrentAngle.y);
	if (YDiff > 180.f)
		YDiff = 360.f - YDiff;

	return sqrt(pow(YDiff, 2) + pow(AimAt.x - CurrentAngle.x, 2));
}
Hi, I got a problem with my aimbot. When trying to get the distance from my crosshair to the position I want to aim at works fine but if the enemy is at
-175 while my viewangles is at 175 the distance will be 350 instead of 10, how can I fix that?. Probably simple math but I'm 14 so I haven't really learnt this in school or anywhere else. Note that I also have the pitch counted, that's why some are 405 degrees away from my viewangles, used http://www.purplemath.com/modules/distform.htm to get the distance.

Picture and video if I was a bit unclear




​​One "solution" I came up with is that if the target angle's Y is less than 0 then add 180 so it becomes

But then my cheat would think that the right 90 is the same position as the left 90 so my aimbot'd f**k up and I'd hit enemies that are behind me, right?

​
​​