coolman++ Advanced Cheater Reputation: -1
Joined: 19 Jul 2012 Posts: 79 Location: Saudi Arabia
|
Posted: Tue Jul 24, 2012 8:21 am Post subject: Modern Warfare 3 Aimbot (UPDATED) |
|
|
For this you will need basic C++ knowledge, and a C++ compiler (of course cheat engine!). You will also need to know how basic memory scanning works, and a little bit of math knowledge too (Trigonometry). This tutorial is not meant for you to go use aimbots in multiplayer and get yourself banned. Before you get started, make sure you go to mw3's video settings and set it to windowed mode (not gonna go into much detail for that lol). VERY IMPORTANT: Copy pasting from any part of this tutorial will NOT get you anywhere, why? Because I am just giving an idea on HOW to make it, I am not going to make one for you! Plus I won't tell you how to get enemy addresses in MULTIPLAYER muhahahaha Alright, so let's get started!
----------Getting the coordinates--------
EDIT: looks like someone did a better job than me in explaining this section!
/viewtopic.php?t=519072
Our first step is to get our player's X Y Z coordinates, as well the mouse looks (LookX and LookY). This is quite easy (don't panic just yet!). In mw3, go to the stay
sharp mission. Why am I choosing this? Because no enemies can whoop your ass while you're at work. This tutorial will only cover single player scanning. I am not
allowed to talk about multiplayer here. We will scan Z first since it is the easiest. While you are at the stay sharp mission, open cheat engine and attach it to
iw5sp.exe. So far all the fps games I have played have coordinates stored as float values. Scan type unknown initial value (although it ranges from -2000 to 2000,
depending on your map). Hit first scan. Now while you're in game, jump, and pause the game while you're in mid-air. Go back to cheat engine, scan increased value,
resume the game, when you are back on the ground, scan decreased value. Repeat this and hit unchanged value a couple of times to mix it up. If you are still getting a
lot of addresses, try shooting and rotating camera view, BUT DON'T CHANGE your Z-position. Stop scanning when you have only about 300-400 addresses. Then select all of
them and click the red arrow to add them to the table at the bottom. Pause the game for what comes next. Now highlight the addresses about halfway through the top of
your cheat table, press enter, then type 1000. Resume the game. If you fell and died after you resumed the game, the correct address is in the top half. If nothing
changed, then delete the addresses you changed, they are useless. If the top addresses didn't have the actual Z-coordinates, select the bottom half of the addresses in
the table and try changing them to 1000. Keep eliminating the addresses until you have found just the one left. On my version of the game the address was 012A9564.
For the X-Coordinates, Move north, scan increased, Move south, scan decreased. Now it will easier for you to eliminate. My Z-coordinates started with 012, so look at
the address that is very similar to the Z-coordinates one. For the Y-coordinates, You have to move east, scan increased, move west, scan decreased. For the mouse look,
change mouse view, scan changed value, hit unchanged a few times, narrow it down, but don't waste your time trying every single one, find the one near the player's
base address.
Once you have the working coordinates (by working I mean you can change them), it's time to move on! Actually, you should take a break first.
--------Collecting the Data----------------
You need to make sure you have the coordinates, AND the base address of your player. At the very beginning of your script, define the two bases:
mBase -- My Base, holds MY player's base address
hBase -- Host Base, your enemy's base address
You also need two functions and a structure.
GetMyPlayerData(void)
PLAYER_DATA GetPlayerData(BYTE PlayerNumber)
void SetCrosshairOnEnemy(BYTE PlayerNumber)
The PLAYER_DATA structure holds the player's base address, X/Y/Z and mouse look coordinates, and the address to those coordinates. The address for the player's name
helps if you want to paint it somewhere on the screen (just use the text search in cheat engine).
typedef struct _PLAYER_DATA {
DWORD baseadd; // base address of the current player
DWORD coordX; // East/West (X) co-ord
DWORD coordY; // North/South (Y) co-ord
DWORD coordZ; // Up/Down (Z) co-ord
DWORD coordXa; // The address of the players X co-ord
DWORD coordYa; // The address of the players Y co-ord
DWORD coordZa; // The address of the players Z co-ord
DWORD lookX; // The players X-axis mouse look
DWORD lookY; // The players Y-axis mouse look
DWORD lookXa; // The address of the X-axis mouse look
DWORD lookYa; // The address of the Y-axis mouse look
} PLAYER_DATA;
Initiate all the data to zero: ZeroMemory(&Player, sizeof(PLAYER_DATA));
Get the player's base address from the pointer: Peek((void*)mBase,(void*)&Player.baseadd,4);
The coordinates are part of Player, so to avoid spaghetti code, you need to define the coordinates by relating them to the base address.
For example:
Player.coordXa = Player.baseadd + 0x2 // 0x2 is just an example of an offset
Do the same as above for the rest of your coordinates. You would read the info from the addresses like this:
Peek((void*)Player.coordXa,(void*)&Player.coordX ,4);
return Player;
}
---------Geometry------------
Alright folks, if you failed math, this is where you have to stop!
This guide will give you ONE way of calculating the angles. The player position is divided into four sectors:
Sector 1: South-East
Sector 2: South-West
Sector 3: North-West
Sector 4: North-East
To add these to the aimbot's source:
void SetCrosshairOnEnemy(BYTE PlayerNumber)
{
PLAYER_DATA oP = GetPlayerData(PlayerNumber); // oP = Enemy Player
PLAYER_DATA cP = GetMyPlayerData(); // cP = Current Player (our player)
For the sectors:
/*Sec 1*/
if(oP.coordX > cP.coordX && oP.coordY <= cP.coordY)
{ }
/*Sec 2*/
if(oP.coordX <= cP.coordX && oP.coordY < cP.coordY)
{ }
/*Sec 3*/
if(oP.coordX < cP.coordX && oP.coordY >= cP.coordY)
{ }
/*Sec 4*/
if(oP.coordX >= cP.coordX && oP.coordY > cP.coordY)
{ }
}
To calculate the angle of aim, we have to think of a triangle that forms between the X-axis, Our player, and the enemy player. The angle we need to calculate is the
apex, the one we look through. Since we have the side opposite the angle (The Y axis), and the side adjacent (X axis), we can use the tangent function to calculate the
angle (I told you it wouldn't be hard!).
Recall: Tan(angle) = Opposite/Adjacent (Thanks to SOHCAHTOA )
Make sure when you're coding these in that the X-dif and Y-dif between you and the enemy are stored as a double so you can do the trig calculations.
Now we can add to our sector's coding:
/*Sec 1*/
if(oP.coordX > cP.coordX && oP.coordY <= cP.coordY)
{
Xdif = oP.coordX - cP.coordX;
Ydif = cP.coordY - oP.coordY;
}
/*Sec 2*/
if(oP.coordX <= cP.coordX && oP.coordY < cP.coordY)
{
Xdif = cP.coordX - oP.coordX;
Ydif = cP.coordY - oP.coordY;
}
/*Sec 3*/
if(oP.coordX < cP.coordX && oP.coordY >= cP.coordY)
{
Xdif = cP.coordX - oP.coordX;
Ydif = oP.coordY - cP.coordY;
}
/*Sec 4*/
if(oP.coordX >= cP.coordX && oP.coordY > cP.coordY)
{
Xdif = oP.coordX - cP.coordX;
Ydif = oP.coordY - cP.coordY;
}
}
To get the angle instead of getting the tangent, you can use the function atan (used for inverse tangent). However, this function will return the angle in degrees. To
convert radians to degrees, you need to multiply by 57.29578 (and don't forget to include the math.h header).
To find the percentage of your X-look (out of 360), you need to divide the angle by 360, then multiply the number you get by the maximum value of the X-look. Let's
update our code then, shall we?
void SetCrosshairOnEnemy(BYTE PlayerNumber)
{
PLAYER_DATA oP = GetPlayerData(PlayerNumber);
PLAYER_DATA cP = GetMyPlayerData();
double Xdif;
double Ydif;
double angleA; // The angle in degrees formed by the apex of the triangle (Our player, The enemy, and the X-axis)
double angleP; // The decimal percentage of the angle
/*Sec 1*/
if(oP.coordX > cP.coordX && oP.coordY <= cP.coordY)
{
Xdif = oP.coordX - cP.coordX;
Ydif = cP.coordY - oP.coordY;
angleA = atan(Ydif/Xdif) * 57.29578; // To convert radians to degrees
angleP = (angleA/360);
}
/*Sec 2*/
if(oP.coordX <= cP.coordX && oP.coordY < cP.coordY)
{
Xdif = cP.coordX - oP.coordX;
Ydif = cP.coordY - oP.coordY;
angleA = atan(Ydif/Xdif) * 57.29578;
angleP = (angleA/360);
}
/*Sec 3*/
if(oP.coordX < cP.coordX && oP.coordY >= cP.coordY)
{
Xdif = cP.coordX - oP.coordX;
Ydif = oP.coordY - cP.coordY;
angleA = atan(Ydif/Xdif) * 57.29578;
angleP = (angleA/360);
}
/*Sec 4*/
if(oP.coordX >= cP.coordX && oP.coordY > cP.coordY)
{
Xdif = oP.coordX - cP.coordX;
Ydif = oP.coordY - cP.coordY;
angleA = atan(Ydif/Xdif) * 57.29578;
angleP = (angleA/360);
}
}
Make sure you convert the DWORDS to doubles before this next step.
Ok now we will be tracking our enemy on the X-axis. Values on the X-axis go counterclockwise. For the Y-axis, moving north is an addition, moving south is a dec op.
Therefore:
Sec 1 = east - current position
Sec 2 = west + current position
Sec 3 = west - current position
Sec 4 = east + current position
Alright so trigonometry again. This time we already have our X-axis locked on to them, so it is a 90 degree angle. The next calculation will be for our Y-look. The
triangle is formed by our area of sight, player, and the enemy player. There are only two sectors for the Y-look, if the enemy is directly underneath us (Mw3 allows
you to shoot through the floor and kill people) or above us. Make sure you declare:
double halfCircle = 0xFFFFFFFF/2;
double flatDist = sqrt((EWdif*EWdif)+(NSdif*NSdif)); // Getting the Z-difference between us and the enemy using the Pythagorean Theorem
if(oP.coordZ == cP.coordZ)
{
BYTE zero4[4] = {0x00,0x00,0x00,0x00};
Poke((void*)cP.lookYa,zero4, 4);
// If the enemy has the same height as us, set our Y-look to 0 (level)
} else if(oP.coordZ > cP.coordZ)
{
UDdif = oP.coordZ - cP.coordZ; // Work out Zdif
angleB = atan(UDdif/flatDist) * 57.29578;
angleBP = (angleB/360);
newValueb = 0 + (0xFFFFFFFF*angleBP);
newValueb2 = newValueb;
Poke((void*)cP.lookYa, &newValueb2,4);
} else if (oP.coordZ < cP.coordZ)
{
Zdif = cP.coordZ - oP.coordZ;
angleB = atan(Zdif/flatDist) * 57.29578;
angleBP = (angleB/360);
newValueb = 0xFFFFFFFF - (0xFFFFFFFF*angleBP);
newValueb2 = newValueb;
Poke((void*)cP.lookYa, &newValueb2,4);
}
}
-------------------------WALLHACK------------------
Nothing fancy, just paint the enemy coordinates in game using any programming language of your choice. Might wanna include distance difference too.
|
|