HelpMaking an aimbot and calculating coordinates

Posts 1–13 of 13 · Page 1 of 1
Making an aimbot and calculating coordinates
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 following the tutorial - <link censored>

But for some reason the cursor jumps all over and behaves weirdly.
Some help appreciated. Thanks in advance.
Hmm I saw it already got censored with "***"...

Anyway should I post a code what I'm trying to do?

EDIT: Here some of the codes:

float PI = 3.14159265F;
float RAD = 57.29578F;
float halfCircle = 0xFFFF / 2;

struct player_info
{
float x;
float y;
float z;
};

inline float Get3dDistance(player_info him, player_info me)
{
float D_x = him.x - me.x;
float D_y = him.y - me.y;
float D_z = him.z - me.z;

return sqrt( D_x * D_x + D_y * D_y + D_z * D_z );
}

/*Sec 1*/
if (enemy.x > user.x && enemy.y <= user.y)
{
D_x = enemy.x - user.x;
D_y = user.y - enemy.y;
yaw = 0xFFFF - (0xFFFF * (short)atan(D_y / D_x) * RAD / 360);
}

/*Sec 2*/
if (enemy.x <= user.x && enemy.y < user.y)
{
D_x = user.x - enemy.x;
D_y = user.y - enemy.y;

yaw = halfCircle + 0xFFFF * (short)atan( D_y / D_x ) * RAD / 360;
}

/*Sec 3*/
if (enemy.x < user.x && enemy.y >= user.y)
{
D_x = user.x - enemy.x;
D_y = enemy.y - user.y;

yaw = halfCircle - 0xFFFF * (short)atan( D_y / D_x ) * RAD / 360;
}

/*Sec 4*/
if (enemy.x >= user.x && enemy.y > user.y)
{
D_x = enemy.x - user.x;
D_y = enemy.y - user.y;

yaw = 0xFFFF * (short)atan( D_y / D_x ) * RAD / 360;
}

float flatDist = sqrt( ( D_x * D_x ) + ( D_y * D_y ) ); // Get the level distance between us and the enemy, using pythagoras

if (enemy.z == user.z)
{
pitch = 0;

} else if (enemy.z > user.z)
{
pitch = 0xFFFF * (short)atan( (enemy.z - user.z) / flatDist ) * RAD / 360;

} else if (enemy.z < user.z)
{
pitch = 0xFFFF - 0xFFFF * (short)atan( (user.z - enemy.z) / flatDist ) * RAD / 360;
}
You get the rotation in degrees/radians, not screen coordinates for your cursor
Easiest is using trigonometry to obtain the angles and writing those to your local players' angles. If you want to use screen coordinates you'll have to apply Pythagoras and more trig to calculate the screen coordinates(more work and slower)
You mean like this:

Code:
float PI = 3.14159265F;
float RAD = 57.29578F;

struct player_info
{
	float x;
	float y;
	float z;
};

inline float Get3dDistance(player_info him, player_info me)
{
	float D_x = him.x - me.x;
	float D_y = him.y - me.y;
	float D_z = him.z - me.z;

	return sqrt( D_x * D_x + D_y * D_y + D_z * D_z );
}

inline void aim(player_info him, player_info me, float &yaw, float &pitch)//0-180 pitch, 0-360 yaw
{
	float D_x = him.x - me.x;
	float D_y = him.y - me.y;
	float D_z = him.z - me.z;
	
	pitch	= sin( D_z / sqrt(D_x * D_x + D_y * D_y + D_z * D_z ) ) * 180 / PI;
	yaw		= -atan2( D_x, D_y ) / PI * 180 + 180;
}

aim(enemy, user, yaw, pitch);

*(WORD*)address = abs((short)pitch);
address += 4;
*(WORD*)address = abs((short)yaw);
It doesn't work too...
It would be useful if you'd specify what is broken about it. Does it snap onto something? Does it spin? Does it crash? etc.
It's just looking at something else and when I move the player it doesn't move too, so something is broken... With the algorithm I think.

OK just now I got told that this algorithm work only with cube engine.
The 'not moving' part could mean that your game uses degrees instead of radians, multiply the rotation values by 57.296f(which is 180 / Pi) to get degrees out of radians.
Yes but the problem is that the mouse X and Y aren't in degrees nor radians.

First I need to know; When going up a ladder in the game, which one Y or Z will increase?

Here is the info about the X and Y of the mouse position:

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.

I assume the Z coordinate is the one that gets increased.
Quote Originally Posted by Jabberwock View Post
Yes but the problem is that the mouse X and Y aren't in degrees nor radians.

First I need to know; When going up a ladder in the game, which one Y or Z will increase?

Here is the info about the X and Y of the mouse position:

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.

I assume the Z coordinate is the one that gets increased.
Print the values on the screen.. "assuming" things isn't a good idea for this. But probably the Z increases when you get higher
would be like this i assume

that would be easy as long as you have target position, camera position and writable camera rotation offsets, and ofc some trigonometry knowledge...
If you know what vectors are, then there's an easier way to do it than trigonometry (and definitely cleaner).
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us