is a simple method that changes viewangles ONLY when you shoot a bullet (in that moment, the punchangle is calculated and decreased to viewangles), you can put this on any client function...

Credits for this garbage: Cristian 'Gaynnegan' Slamer
Code:
//Just in case that you don't have this...
#define VectorClear(a) { a[0]=0.0;a[1]=0.0;a[2]=0.0;}
 
void AntiRecoil ( )
{
	if ( aimbot_recoil->value && Local.Alive )
	{
		static int LastShoot;
		static int IsShooting;
		IsShooting = *(int*) (DWORD) 0x02DE10D3; //This value ALWAYS change when you shoot ANY weapon...
 
		if ( IsShooting != LastShoot )
		{
			//Should be different because we are shooting various bullets...
			LastShoot = IsShooting;
 
			static float ViewAngles[3], NewPunchangle[3];
			static float PrevPunchangle[3];
 
			NewPunchangle[0] = ppmove->punchangle[0] * 2.0f; //*2 works fine...
			NewPunchangle[1] = ppmove->punchangle[1] * 2.0f; //*2 works fine...
 
			//This avoid problems...
			if ( ( NewPunchangle[0] == 0.0f ) && ( NewPunchangle[1] == 0.0f ) )
				VectorClear ( PrevPunchangle );
 
			//This will obtain the current viewangles...
			ViewAngles[0] = *(float*) ( (DWORD) 0x02DE10C4 );
			ViewAngles[1] = *(float*) ( (DWORD) 0x02DE10C8 );
			ViewAngles[2] = *(float*) ( (DWORD) 0x02DE10CC );
 
			//Decrease the punchangles & the previous punchangles...
			ViewAngles[0] -= NewPunchangle[0] - PrevPunchangle[0]; 
			ViewAngles[1] -= NewPunchangle[1] - PrevPunchangle[1];
 
			//Set new viewangles with the punchangles decreased...
			*(float*) 0x02DE10C4 = ViewAngles[0];
			*(float*) 0x02DE10C8 = ViewAngles[1];
			*(float*) 0x02DE10CC = ViewAngles[2];
 
			//Save the punchangles to avoid problems with the new punchangles...
			PrevPunchangle[0] = NewPunchangle[0]; 
			PrevPunchangle[1] = NewPunchangle[1];
		}
	}
}
Notes: 0x02DE10C4 to 0x02DE10CC is a pointer in RAM where you viewangles are and ppmove is required here (that can be omitted by searching the punchangle data in RAM and adding the respective pointers).
Worth to say that this DOESN'T look legit when someone is spectating you.