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.)
I have created a JavaScript illustration that uses the same math and partly the same formulas as I do in the program (open in a new window/tab and view its source for more information). Without the funnel limitation, the aim would only jump between the enemies. This requires the user to aim in a general direction first and the software becomes more of a strong snap-to-target assistant and a little more subtle than just auto aiming everywhere.
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).