Solved Making an aimbot and calculating coordinates

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Jabberwock

Newbie
Sep 24, 2012
29
288
0
Hi guys, it's me again.

I need help in the calculations of an aimbot.(A memory aimbot)

I have all the addresses I just have trouble calculating the hack itself. So here are the types:

The player coordinates x, y and z are float type.
The cursor coordinates x and y are WORD type.

I have tried a tutorial here.

But for some reason the cursor jumps all over and behaves weirdly.
Some help appreciated. Thanks in advance.
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
Hey Jabberwock,

Just need to clear a few things up before I can help.

The things you need for the aimbot are:

Player:
position (x, y, z)
direction you're looking (usually in Euler angles)

And a position to look at. (Enemies head position.. )

Do you have the direction the player is looking?
 
  • Like
Reactions: Jabberwock

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
ok cool,

You're going to need to check if the cursor coordinates are in degrees or radians. (if it's not either then please post what game it is or what they are set to when you look up, look down, look straight and a few others)

Also you may need to check what coordinate system is being used.
Most games I've seen have X - right, Z - forward, Y - up

Y Z
| /
|/_ _ X

O - The players position
P - Position to look at

// get the relative coordinates
float dx = P.x - O.x;
float dy = P.y - O.y;
float dz = P.z - O.z;

// the length of the vector
float m = sqrt(dx*dx + dy*dy + dz*dz);

if(m < 0.000001) // if this is true then the position you want to look at is too close to you
return; // be careful not to divide by zero...

// normalise the vector
dx = dx / m;
dy = dy / m;
dz = dz / m;

if(fabs(dz) > 0.9999999) { // special case
if(dz < 0) {
// look down
// just set the mouseY to be down degress (-90) radians (-PI/2)
} else {
// look up
// just set the mouseY to be down degress (90) radians (PI/2)
}

return;
}


. /|
a/ |dz
/__|
dx

float a = sqrt(1 - dy*dy);

float mouseX = acos(dx/a);

. /|
1/ |dy
/__|
a

float mouseY = asin(dy);

// some games also have strange things where they add/minus an extra 90 degrees to the mouseX

// if the game is in radians you should be able to just set mouseX and mouseY now

// if the game is in degrees just convert it to degrees by

mouseX *= 180.0f / PI;
mouseY *= 180.0f / PI;

// now set them

Not sure if this explains it very well but it may help you figure out what you need
 
Last edited:
  • Like
Reactions: Jabberwock

Jabberwock

Newbie
Sep 24, 2012
29
288
0
Wow, thank you very much. Finally someone who explains it well!

The mouse coordinates are WORD type and they are not in degrees or radians.

The mouse Y:
straight = 0.
down = 50535.
up = 15000

The mouse X:

When setting to 0 and going to that direction the x coordinate get higher.
When setting to 32768 and going to that direction the x coordinate get lower.
When setting to 16384 and going to that direction the y coordinate get higher.
When setting to 49152 and going to that direction the y coordinate get lower.

Also I might made a mistake and swapped between the z and y. From my understanding when going up a ladder in the game the z coordinate is the one that grow right?

Thank you very much for helping me!
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
Try these out, they should be close

[mouseX and mouseY are from before] (the radian versions)

short newMouseY = (short)(15000 * mouseY / (PI / 2));
short newMouseX = (short)(32767 * mouseX / PI);
 
  • Like
Reactions: Jabberwock

Jabberwock

Newbie
Sep 24, 2012
29
288
0
Now it acts weirdly but it does react to the movement of the player.

Just to be sure that I'm right about the x, y and z. When going up a ladder in the game which one of them will increase? The z or the y? In some graphs I see the y and others the z...
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
with the coordinate system i'm using y should increase.

also the newMouseX may need to 32767 to be change i just guessed that one.
 

Jabberwock

Newbie
Sep 24, 2012
29
288
0
Thanks for the quick response. Also I see that you type casted them both to short type but they are actually unsigned short.
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
I believe they are actually shorts in the game, if you look at 50535 as signed it's -15001
 
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