first, the basic aimbot math it's: PointTarget - YourOrigin:
that will generate the vector between 2 angles, now for get the Pitch/Yaw this will be variable on every game, in this case you will need use VectoAngles(); from quake sdk, because the game still works on that math base... one recommendation is to reverse the game if possible and avoid things like the ones you are trying to do... cheers...