I made my first aimbot for fun during christmas 2018 to play around with angle calculations, view matrix and all that stuff. Aim Lock with Reduced Recoil (skull/head bone, mbutton5 snap-to-head within a 9° angle / funnel, priority determined by distance and visibility. Simple 3D radar/ESP Overlay (transparent double buffered GDI, no writing or interference of internal performance or graphics).
(Names were added to the ESP/2D radar after making this vid.)
Trigonometry math plays a huge part when dealing with aimbots. Normalizing all direction vectors to units makes it practical to take the dot product from those units to calculate the angle difference between the forward player direction vector and enemy location vector. Then it becomes easy to check the 9° funnel. Aiming itself was done with asin and atan functions to find the pitch/yaw angles (I found atan2f in math.h does the heavy lifting of figuring out positive/negative quadrants, atanf doesn't).