Pretty simple:
1. Get your and the enemys position
2. Calculate the angle between you and him with CalcAngle:
Code:
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) (atan(delta[2]/hyp) * 180.0 / 3.14159265);
****angles[1] = (float) (atanf(delta[1]/delta[0]) * 57.295779513082f);
****angles[2] = 0.0f;
*
****if(delta[0] >= 0.0)
****{
********angles[1] += 180.0f;
****}
}
Just pasted the first calcangle function i found on google. Cred kaz.
float* src is a float array with your position.
float* dst the enemys position
float* angles is the angles u want to set so make a float array like this:
and pass it to the function.
3. Set your angles to AimAngle^^
you can also add smoothing, rcs and angle clamping but that's your problem, don't use this on Valve servers until you have clamped the angles cause that will give you an untrusted ban.