Guide Start Here Aimbot Tutorial Guide - How to Make an Aimbot

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Rake

Cesspool Admin
Administrator
Jan 21, 2014
11,539
78,998
2,312
Game Name
N/A
Anticheat
N/A
Tutorial Link:
N/A
How long you been coding/hacking?
5 years
Coding Language
N/A
What is an Aimbot?
An aimbot is a hack feature which makes your player aim at the enemies automatically.

Required Experience
You must have completed the Start Here Guide and the Reverse Engineering Guide. This is not a joke, do the guides or I will ban your ass.

Stop Pasting
Guide - Stop Pasting - Focus on the Basics

Most Important Aimbot Tutorial
Our most important aimbot tutorial is from @BDKPlayer


How does an aimbot work?
An aimbot works like most hacks, by accessing the game memory then it:
  1. Parses the games entitylist, a list of players which contain the enemy objects
  2. Checks if the enemies are alive, visible & valid targets using a GetBestTarget() function
  3. GetBestTarget() will sort the targets by angle or distance by using the Distance formula or CalcAngle
  4. When the BestTarget is found it will set the view angles to aim at the enemy.

Entity List
You need to know how to find and parse entitylists, do our guide:
Guide - Getting Started How to find the Entity List


CalcAngle
CalcAngle is a function that takes your current position and the target's position and calculates the angle from your current position to the target position. There are 3 or 4 methods of doing CalcAngle depending on how the game works. You will typically use the same 2 functions in every game with minor modifications


Learn about angles
Tutorial - How to Find View Angles with Cheat Engine

There are many ways to represent angles and coordinate systems in 3D game programming, these are called Rotation formalisms in three dimensions. The most common are
Rotation Matrix, Eular angles, Quaternions. Angles can be expresses as radians or degrees.

The most common is Eular Angles, you will see them express as a vec3, yaw and pitch are often swapped
C++:
struct vec3
{
    float x; //yaw
    float y; //pitch
    float z; //roll
}

CalcAngle Functions
We have lots of functions available
Source Code - Ultimate CalcAngle Thread - How to Calculate Angle Functions
Source Code - CSGO and Source Engine CalcAngle Function for aimbot

The most common looks like this:
C++:
vec CalcAngle(vec3 src, vec3 dst)
{
    vec3 angle;
    angle.x = -atan2f(dst.x - src.x, dst.y - src.y) / PI * 180.0f + 180.0f;
    angle.y = asinf((dst.z - src.z) / Distance(src, dst)) * 180.0f / PI;
    angle.z = 0.0f;

    return angle;
}
Radians & Degrees Conversions
C++:
float RadianToDegree(float radian)
{
    return radian * (180 / PI);
}

float DegreeToRadian(float degree)
{
    return degree * (PI / 180);

}

vec3 RadianToDegree(vec3 radians)
{
    vec3 degrees;
    degrees.x = radians.x * (180 / PI);
    degrees.y = radians.y * (180 / PI);
    degrees.z = radians.z * (180 / PI);
    return degrees;
}

vec3 DegreeToRadian(vec3 degrees)
{
    vec3 radians;
    radians.x = degrees.x * (PI / 180);
    radians.y = degrees.y * (PI / 180);
    radians.z = degrees.z * (PI / 180);
    return radians;
}
Trigonometry
It's not mandatory to learn trigonometry but you should at least understand the basics of Pythagorean theorem, sine, cosine and tangent and their arc variants. Once you know the basics you can get by with pasting the CalcAngle functions that we have generously provided. If you want to be a PRO, learn it!

You will learn some trig stuff and how CalcAngle works from these threads
If you're writing your own CalcAngle from scratch using trig you will need to resolve these types of issues:
1581561343813.png


Normalizing & Clamping Angles
There are 4 quadrants when looking at a 2D plane, depending which quadrant you are in, X and Y have different signs, positive or negative

1581560684072.png


Yaw and Pitch for example are between -90 and +90, -180 or +180 or any other conceivable format a developer can come up with. Normalizing and clamping makes sure the angles you're writing are correct. These functions are not always required and not always identical, sometime requiring minor modification

C++:
void ClampAngle(vec3& angle) {
    if (angle.x > 89.0f) angle.x = 89.f;
    if (angle.x < -89.0f) angle.x = -89.f;

    if (angle.y > 180.f) angle.y = 180.f;
    if (angle.y < -180.f) angle.y = -180.f;

    angle.z = 0.0f;
}

void Normalise(vec3& angle) {
    if (angle.x > 89.0f) angle.x -= 180.0f;
    if (angle.x < -89.0f) angle.x += 180.0f;

    while (angle.y > 180) angle.y -= 360.f;
    while (angle.y < -180) angle.y += 360.f;
}
GetBestTarget & Sorting Entities
The simplest GetBestTarget() function looks like this:

C++:
Ent* GetBestTarget(Ent* localPlayer, EntList* entList)
{
    float oldDistance = FLT_MAX;
    float newDistance = 0;
    Ent* target = nullptr;

    for (auto ent : entList)
    {
        if (ent && ent->clientId != localPlayer->clientId && ent->lifeState == 0)
        {
            vec3 angleTo = CalcAngle(localPlayer->pos, ent->pos);
            newDistance = Distance(localPlayer->angles, angleTo);
            if (newDistance < oldDistance)
            {
                oldDistance = newDistance;
                target = ent;
            }
        }
    }
    return target;
}
The above function sorts by angle, so it will return the entity which is closest to your crosshair, meaning the lowest difference in angle from current angle to the enemy. It does this by using the Distance() function on the currentAngles and the aimbotangles. It makes sure the entity is valid also, it is common to make a separate function called "IsValidEnt()" also.

You can also use a coefficient to make your GetBestTarget() take into account angle and 3d distance. Assign a percentage weight to distance and angle, lets say 30% distance and 70% angle.

coefficient = distance * 0.3 + angle * 0.7;

Then sort by lowest coefficient.

FOV Aimbot
Source Code - Correct angle comparison for FOV aimbot
Tutorial - How to make an FOV aimbot

TargetLock
If your aimbot is aiming at an enemy, but another enemy passes in front of your current target, your aimbot will probably switch to them. In some cases this is a good thing, but most people want to disable that. To stop it, you must implement a target lock mechanism. This is incredibly easy. If you can't figure out how to do it using logic then you're a dirty disgusting paster.

PsuedoCode:

C++:
if (IsGoodTarget(currTarget))
{
    //don't change targets
}

Aimbot Smoothing
A regular aimbot will snap right onto the target, which is very obvious. To make it more natural you use smoothing. You get the delta angle (the difference between) current angle and the angle to the enemy. You divide by a predefined increment, and then you add that incrementally to your current view angles.

Smoothing = linear interpolation

To make a smooth aimbot you use something called linear interpolation, here is the basic idea:

C++:
int increments = 10;

vec3 dst = CalcAngle(mypos, enemypos);
vec3 diff = dst - src;
SetAngles(src + diff / increments);
src = current angles

It will move towards the target, you will probably need to normalize the angles.

Here's a few code examples:
C++:
float smoothing = 4.0f;

// Get the view angles we need to aim at
Vec3D aimbotAngle = calcAngles(Vec3D(pLocal->o.x, pLocal->o.y, pLocal->o.z), Vec3D(ent->o.x, ent->o.y, ent->o.z ));

// Get the difference between the angles we need, and our current ones for smoothing
Vec3D diffs = aimbotAngle - Vec3D(pLocal->yaw, pLocal->pitch, pLocal->roll);

pLocal->yaw += diffs.x / smoothing;
pLocal->pitch += diffs.y / smoothing;
C++:
POINT nextMousePosition, currMousePosition;

GetCursorPos(&currMousePosition);

nextMousePosition.x = currMousePosition.x + (Target.x - currMousePosition.x) / 10;
nextMousePosition.y = currMousePosition.y + (Target.y - currMousePosition.y) / 10;

mouse_event(MOUSEEVENTF_MOVE, nextMousePosition.x, nextMousePosition.y, 0, NULL);
C++:
int smoothing = 5;

    if (toShoot){
        // Calculate the needed angles
        Vec3D result = calcAngles(Vec3D(pLocal->o.x, pLocal->o.y, pLocal->o.z), Vec3D(toShoot->o.x, toShoot->o.y, toShoot->o.z));

        if (smoothing){
            // Get the difference between our wanted angles and our current angles
            Vec3D diffs = result - Vec3D(pLocal->yaw, pLocal->pitch, pLocal->roll);

            // Prevent 360 spins
            if (diffs.x > 180)
                diffs.x -= 360;

            if (diffs.x < -180)
                diffs.x += 360;

            // Smewth
            pLocal->yaw += diffs.x / smoothing;
            pLocal->pitch += diffs.y / smoothing;
        }

        else{
            // Snap to them without any smoothing
            pLocal->yaw = result.x;
            pLocal->pitch = result.y;
        }
    }
}
Human Aim
How to make it seem more human, there are many ways
  • Use bezier curves
  • Add some randomness
  • Don't make every shot hit the enemy, miss a couple before and after locking on
  • Start shooting 0.25 seconds before you're aiming at enemy and stop shooting 0.5 seconds after
SilentAim
Silent aim shoots targets without visibly showing spectators you're aiming at them
Tutorial - How to do Silent Aim in CS:GO

How to set / write View Angles

Internally or externally the best thing to do is just overwrite the view angles. If you're external just use WriteProcessMemory, if you're internal just set them. Sometimes you need to use external methods to avoid anticheat such as SendInput or if the view angles aren't easily writeable.

If you can't overwrite the angles then you can use something like these functions, which don't use view angles but use WorldToScreen 2D screen coordinates of the enemy

C++:
void MoveMouse(vec3 point)
{
    INPUT Input = { 0 };
    Input.type = INPUT_MOUSE;
    Input.mi.dwFlags = MOUSEEVENTF_MOVE;
    Input.mi.dx = point.x - WINDOWWIDTH / 2;
    Input.mi.dy = point.y - WINDOWHEIGHT / 2;
    SendInput(1, &Input, sizeof(INPUT));
}
C++:
void AimAt(vec3* point)
{
    float aX, aY;

    vec2 screen[2];
    if (!WorldToScreen(pRefdef, point, &screen))
        return;

    float centerX = pRefdef->width / 2.f;
    float centerY = pRefdef->height / 2.f;

    float enemyX = screen.x;
    float enemyY = screen.y;

    aX = enemyX - centerX;
    aY = enemyY - centerY;

    if (bSmoothAim)
    {
        aX /= fSmoothAmount;
        aY /= fSmoothAmount;
    }

    mouse_event(MOUSEEVENTF_MOVE, aX, aY, 0, 0);
}
C++:
void MoveMouse(float X, float Y, float Interval)
{
    POINT CurrPos;
    GetCursorPos(&CurrPos);

    X = (X - CurrPos.x) / Interval + CurrPos.x;
    Y = (Y - CurrPos.y) / Interval + CurrPos.y;

    mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, static_cast<DWORD>(X) * 65535 / ScreenWidth, static_cast<DWORD>(Y) * 65535 / ScreenHeight, 0, 0);

}

//Use it like dis:

for (UINT i = 30; i; --i) //Stepcount
{
    MoveMouse(x, y, i);
    Sleep(SomeAimDelay);
}

Good Examples to Learn How to Make an Aimbot
 
Last edited:

Blackvz

Newbie
Full Member
Aug 20, 2013
5
172
0
Hello all :eek:

So can someone explain me how to make an aimbot?

I've found the (x|y) coordinates of me and the enemy. And I have my cursor position. I want to make an Aimbot for a simple 2D game.
But how to combine the player-coordinates and the mouse coordinates ?
How to calculate it ?
I dont get , how I can set my mouse position on the enemy (x|y) :/

Please explain and help me a little :p

Thanks and sorry for my english :/
 
Last edited by a moderator:

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
So if its a 2D game u see everything from top. Get your screen position by moving cursor on your char and caling GetCursorPos. Then do the same for one enemy. Count distance with pythagoran (i dont know english version :D but u knwo what i mean). Then count the distance with ingame coords and count proportion. Thats all, this is just a basic math, so you know the screen distance using ingame coords. Then get angle and ur done

Btw game name?
 

Blackvz

Newbie
Full Member
Aug 20, 2013
5
172
0
Game name is Counter Strike 2D. I dont want to ruin the game so I won't release it or play with it online...just btw.
Yea I know what you mean :D . I used the GetCursorPos in C++. I wrote down my Pos but how I do it with the enemy Pos ? I mean it changes everytime he moves and I cant read it from the client mhhh
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
I understand you got memory addresses with actual, live X Y of enemies in the game. Then its just math
 

Blackvz

Newbie
Full Member
Aug 20, 2013
5
172
0
Mh it's still not clear to me.
I can calculate the Ingame-distance with pytagoras. Okay
But even if i have the distance , I still dont know which direction he is ?

What I got is :

Mouse Position in client (got it with C++ GetCursorPos)
Player and Enemy (XY) Coordinates Ingame.

Maybe you can do an example or something. Im still new to this sorry :/
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
You have your world XY and enemy XY. Count angle and ur done
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,188
12,638
76
You don't need to get your mouse position, it's totally irrelevant.
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
i cound distance between pixels and between world coords and divided it
 

Icyvel

Newbie
Full Member
Aug 6, 2013
17
198
0
i cound distance between pixels and between world coords and divided it
Yeah i figured that 27 is the result of 135 divided by 5. I guess my real question is, where did you get the 5 from.

As looking at all 3 points, none of them are in fact 5 in distance.

Let me demonstrate:


// A +5
7 + 5 = 12
5 + 5 = 10

// B + 5
11 + 5 = 16
2 + 5 = 7

// C + 5
13 + 5 = 18
13 + 5 = 18

And tryed with your paint, you said 135 distance on screen, i can't see any of the points having 135 distance to each other either.

You gotta be more specific, I'm worried if it's just a typo of you that you actually ment 4 in game, as the distance between A & B seems to be 4, 7 + 4 = 11
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
lol maybe i made a typo but its so damn easy, just try to calcualte it on a paper and everything is clear..
 

c5

Kim Kong Trasher
Dank Tier VIP
Dank Tier Donator
Jul 19, 2012
1,188
12,638
76
2nd grade math can get overwhelming sometimes lol :lol:
 

till0sch

Respected Hacker
Dank Tier VIP
Dank Tier Donator
Oct 14, 2012
1,107
12,593
51
I remember for Fruit Ninja (2D..) it was like ScreenWidth/2 +- (ScreenWidth/2)*(X/285) or sth similar for the X coord.. (I created an aimbot for the game once...)
 

Szaka

Coder
Full Member
Nobleman
Mar 14, 2013
161
718
3
yea! Thats it... its simple linear function. Get 2 points ingame with same X, count proprtion and same with Y, then u get function y=ax+b for both coords
 

Jaimy

Newbie
Full Member
Oct 3, 2015
8
82
0
hi guys i'm playing a game called Microvolts i have an aimbot called "MVX" i have the code
my request is can someone change this code to a dll file ?

1st code
Code:
C++:
"aim on" - turns on aimbot
"aim off" - turns off aimbot
"aim rifle on" - turns on rifle aimbot
"aim rifle off" - turns off rifle aimbot
"aim shotgun on" - turns on shotgun aimbot
"aim shotgun off" - turns off shotgun aimbot
"aim sniper on" - turns on sniper aimbot
"aim sniper off" - turns off sniper aimbot
"aim gatling on" - turns on gatling aimbot
"aim gatling off" - turns off gatling aimbot
"esp on" - turns on esp(radar)
"esp off" - turns off esp(radar)
"aim rangetotarget 1337" - puts your range - to - target to a specific value, in this case 1337. You can replace the number as you want.
Its the circle size you see while "esp" is on. If your enemy is in that circle, it will be shooted. You can also see the line going from you croshair, to the closest enemy.
"aim aimnext_interval 1000" - just experiment with this value(1000) and rifle aimbot on. You will see, that the less value is, the faster you gona aim to next person.
"aim sniper head 100" - sets sniper headshot posibility to 100%. You can edit the value as you want. 
"jump 1" - sets jump set 
"speed 1" - sets speed set
"ua" - turn unlimited ammo ON / OFF
"uar" - turn unlimited ammo recharges ON / OFF
2nd Code:
its long https://pastebin.com/7UjYWWF0
C++:
-- WINDOWS MESSAGES CONSTANTS
WM_ACTIVATEAPP = 0x001C
WM_KEYDOWN     = 0x0100
WM_KEYUP       = 0x0101
 
-- VIRTUAL KEYS CONSTANTS
VK_CTRL   = 17
VK_A      = 65
VK_B      = 66
VK_C      = 67
VK_S      = 83
VK_V      = 86
--
VK_F1     = 112
VK_F2     = 113
VK_F3     = 114
VK_F4     = 115
---------------
 
-- global variables
local isControlPressed = false
---------------
 
function onKeyDown(key)
  MVXPrint(string.format("key down: %d.", key))
 
  if key == VK_CTRL then
    isControlPressed = true  
  end
 
  if isControlPressed and key == VK_C then -- turn off esp
        MVXProcessCommand("esp off")
        return 1
  end
 
  if isControlPressed and key == VK_V then -- turn off aim
        MVXProcessCommand("aim off")
        return 1
  end
 
  if isControlPressed and key == VK_B then -- toggle unlimited ammo and ammo recharges on/off
        MVXProcessCommand("ua")
        MVXProcessCommand("uar")
        return 1
  end
 
  if key == VK_F3 then
    MVXProcessCommand("aim default")
        return 1
  elseif key == VK_F2 then
   
    --  The following settings are usually used by experienced
        --  players. If you can play using those settings rarely
        --  another will call you "aimbotter", lol.      
         
        --  If you are a beginner on playing shooting games you'd suck using those settings.
       
        MVXProcessCommand("aim default")
    MVXChatPrint("MVX PRO Player settings\n")
    MVXProcessCommand("aim rangetotarget 50")
        --  reduces the aimbot range to 50 pixels, the aim range is shown by a yellow circle during the game.
 
        MVXProcessCommand("aim aimnext_interval 1000")
        --  after the index target get killed the next will be targeted only after 1 second (1000 milliseconds)
        --  this does avoid "jolt" movements
        MVXProcessCommand("aim sniper on")
        MVXProcessCommand("aim sniper head 40")
        --  40% of the shots are aimed to the enemy's head,
        --  if you use 100% headshots people will cry a lot calling you "aimbotter".
        --  btw, pro players miss headshots also ;P
        MVXProcessCommand("aim shotgun on")    
        MVXProcessCommand("aim rifle off")      -- MVX Rifle's aimbot is fuckin' op (overpowered) and people may percept or cry a lot if you use it.
        MVXProcessCommand("aim gatling off") -- MVX the same than rifle.       
        MVXChatPrint("\n---")
        return 1
  elseif key == VK_F4 then
        --  The following settings are for players that wants to mess around
        MVXProcessCommand("aim default")
        MVXChatPrint("MVX aggressive player settings\n")
        MVXProcessCommand("aim sniper head 100")
        MVXProcessCommand("aim rifle head")
        MVXProcessCommand("aim aimnext_interval 0")
        MVXProcessCommand("aim rangetotarget 350")
        MVXProcessCommand("ua on")
        MVXProcessCommand("uar on")
        MVXProcessCommand("acs")
        MVXProcessCommand("speed 2")
        MVXProcessCommand("jump 1")
        MVXChatPrint("\n---")
        return 1
  end
end
 
function onKeyUp(key)
  -- disables the isControlPressed flag if any other key goes up
  isControlPressed = false
end
 
function wndProc(message,wParam,hiLParam,loLParam)
  local ret = 0  -- if ret is set MVX does NOT allow the message to be processed by the game.
  if message == WM_KEYUP then
    ret = onKeyUp(wParam)
  elseif message == WM_KEYDOWN then
    ret = onKeyDown(wParam)
  elseif message == WM_ACTIVATEAPP then
    if not wParam then
      isControlPressed = false   
        end
  end
  return ret
end
 
MVXPrint("MVX LUA Script 1.1")
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
11,539
78,998
2,312
This is not a full source code, this won't help you do shit, sorry :(
 

Obsta

Jr.Hacker
Meme Tier VIP
Jan 27, 2014
394
2,978
17
Nobody could compile this because of theres no reference to MVXProcessCommand, MVXChatPrint and god knows what else.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts