How can I make the angle calculation stop giving 360 in aimbot?

this is the code i am using

Code:
VOID CalcAngle(FLOAT* fForward, FLOAT* fAngles)
{
	FLOAT fTmp, fYaw, fPitch;

	fYaw = (atan2(fForward[2], -fForward[0]) * 180.0f / M_PI) - 90; // here is the 360

	fTmp = sqrt(fForward[0] * fForward[0] + fForward[2] * fForward[2]);
	fPitch = (atan2(fForward[1], fTmp) * 180.0f / M_PI);		

	fAngles[PITCH] = -fPitch;
	fAngles[YAW] = fYaw;
	
}
and in my case it is not possible to use mouse_event