This site is no longer active, all members have migrated to devotedcheating.com . Thankyou



 
Actionhacks.netHomeFAQRegisterLog in

Share | 
 

 Aimbot Part 2

Go down 
AuthorMessage
unholyshot99
VIP LVL-1
VIP LVL-1


Posts : 8
Reputation : 0
Join date : 2009-11-03
Age : 24
Location : VA

PostSubject: Aimbot Part 2   Wed Nov 04, 2009 9:03 am

THIS IS NOT MY WORK SOMEONE OPEN THIS SOURCE TO THE PUBILC!

Code:
void SetCrosshairOnEnemy(BYTE PlayerNumber)
{
PLAYER_DATA oP = GetPlayerData(PlayerNumber);
PLAYER_DATA cP = GetMyPlayerData();

double EWdif; // These need to be double for our Trig calculations to work later on
double NSdif;

/*Sec 1*/
if(oP.coordEW > cP.coordEW && oP.coordNS <= cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
}

/*Sec 2*/
if(oP.coordEW <= cP.coordEW && oP.coordNS < cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
}

/*Sec 3*/
if(oP.coordEW < cP.coordEW && oP.coordNS >= cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
}

/*Sec 4*/
if(oP.coordEW >= cP.coordEW && oP.coordNS > cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
}
}

Please note that in each sector, the calculations ARE NOT the same. You need to do the biggest take away the smallest…hope that’s obvious. Right, so now we have this, we need to get the angle in degrees. For this, we need to do go back to the formula :

Tan(angle) = Opposite/Adjacent
Tan(angle) = NSdif/EWdif

We need to do the Inverse Tangent function of this, so that we get the angle rather than the Tangent of the angle. The function to do this is atan (could have used atan2 but didn’t know of this function at the time of programming). It takes 1 double parameter, and returns a double value of the angle in radians. But this is no good for us, we want it in degrees. Well, to turn radians into degrees, its a multiplication of ‘57.29578', as found off the tinternet Remember to include <math.h> for the atan function

Then, due to our X-look not having a maximum of 360, it goes upto 0xFFFFFFFF (4294967295), we need to find the percentage what this angle is of 360. This is so that we can find out what value we need to use, for example:

If the angle was 90 degrees
90/360 = 0.25 (decimal percentage of the angle)
0xFFFFFFFF * 0.25 = 3FFFFFFF (roughly), which is the new value we need to use

Let’s put this in the code.



PHP Code:
void SetCrosshairOnEnemy(BYTE PlayerNumber)
{
PLAYER_DATA oP = GetPlayerData(PlayerNumber);
PLAYER_DATA cP = GetMyPlayerData();

double EWdif;
double NSdif;
double angleA; // The angle in degrees between the enemy, east, and us
double angleP; // The decimal percentage of the angle

/*Sec 1*/
if(oP.coordEW > cP.coordEW && oP.coordNS <= cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578; // Remember, the 57.29578 is to convert from radians to degrees
angleP = (angleA/360);
}

/*Sec 2*/
if(oP.coordEW <= cP.coordEW && oP.coordNS < cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
}

/*Sec 3*/
if(oP.coordEW < cP.coordEW && oP.coordNS >= cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
}

/*Sec 4*/
if(oP.coordEW >= cP.coordEW && oP.coordNS > cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
}
}

Next, we need to know what to do with that code now we got a Ss stickleback special coming rite up for ya



To understand, remember that 0 on our X-Look is EAST…and that the values go counter-clockwise. Lets revert back to the sectors :

Sector 1 (SE) = 0xFFFFFFFF (east) - our new value
Sector 2 (SW) = 0xFFFFFFFF/2 (west) + our new value
Sector 3 (NW) = 0xFFFFFFFF/2 (west) - our new value
Sector 4 (NE) = 0 (east) + our new value

Before we write them though, we have to convert them back to DWORDs, from doubles. Here’s the new code :



PHP Code:
void SetCrosshairOnEnemy(BYTE PlayerNumber)
{
PLAYER_DATA oP = GetPlayerData(PlayerNumber);
PLAYER_DATA cP = GetMyPlayerData();

double EWdif;
double NSdif;
double angleA;
double angleP;
double newValue; // To hold our new double value
DWORD newValue2; // To convert our double back into DWORD ready for writing

double halfCircle = 0xFFFFFFFF/2; // Just to make the code a bit more readable

/*Sec 1*/
if(oP.coordEW > cP.coordEW && oP.coordNS <= cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = 0xFFFFFFFF - (0xFFFFFFFF*angleP); // As described above
newValue2 = newValue; // Put it into DWORD (may get compile warnings about losing data..thats the whole reason we’re doing it
Poke((void*)cP.lookXa, &newValue2,4); // Write our new value
}

/*Sec 2*/
if(oP.coordEW <= cP.coordEW && oP.coordNS < cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = halfCircle + (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}

/*Sec 3*/
if(oP.coordEW < cP.coordEW && oP.coordNS >= cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = halfCircle - (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}

/*Sec 4*/
if(oP.coordEW >= cP.coordEW && oP.coordNS > cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = 0 + (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}
}

WOOOO, we now have our X look tracking the enemy we specify (or at least, if you copied and pasted right you should have )

If you’ve managed to read this all in 1 go, well done *round of applause*, this ****er’s taking me ages to write. Okey doke, snack time again, then it’s onto setting the Y-look

//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//-//

Right, for our Y-look it’s still trig, it’s still tan, and we still have to make a triangle. This time, imagine we already have X-look locked on them, and are looking straight infront….the point infront which is the same level distance away from us as he is, which is right above/below him. That is 1 point, then our player, then the enemy player. Here is another class drawing (man, I should put this **** on deviantart :-P) :
This time there are only 2 ’sectors’ââ⠀šÂ¬Ã‚¦if the enemy is below us, or above us.
The distance from us to him along a level view is obtained by pythagoras on the EWdif and NWdif. We then use that, and the UDdif as the Opposite and Adjacent and do the same stuff as before. This time though, we need to include a bit for if the enemy is at the same height as us too
Here’s the updated code :



PHP Code:
void SetCrosshairOnEnemy(BYTE PlayerNumber)
{
PLAYER_DATA oP = GetPlayerData(PlayerNumber);
PLAYER_DATA cP = GetMyPlayerData();

double EWdif;
double NSdif;
double UDdif;

double angleA;
double angleP;
double angleB;
double angleBP;

double newValue;
DWORD newValue2;

double newValueb;
DWORD newValueb2;

double halfCircle = 0xFFFFFFFF/2;

/*Sec 1*/
if(oP.coordEW > cP.coordEW && oP.coordNS <= cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = 0xFFFFFFFF - (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}

/*Sec 2*/
if(oP.coordEW <= cP.coordEW && oP.coordNS < cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = cP.coordNS - oP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = halfCircle + (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}

/*Sec 3*/
if(oP.coordEW < cP.coordEW && oP.coordNS >= cP.coordNS)
{
EWdif = cP.coordEW - oP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = halfCircle - (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}

/*Sec 4*/
if(oP.coordEW >= cP.coordEW && oP.coordNS > cP.coordNS)
{
EWdif = oP.coordEW - cP.coordEW;
NSdif = oP.coordNS - cP.coordNS;
angleA = atan(NSdif/EWdif) * 57.29578;
angleP = (angleA/360);
newValue = 0 + (0xFFFFFFFF*angleP);
newValue2 = newValue;
Poke((void*)cP.lookXa, &newValue2,4);
}

// Done the X-look, now this is for the Y-look

double flatDist = sqrt((EWdif*EWdif)+(NSdif*NSdif)); // Get the level distance between us and the enemy, using pythagoras

if(oP.coordUD == cP.coordUD)
{
BYTE zero4[4] = {0×00,0×00,0×00,0×00};
Poke((void*)cP.lookYa,zero4, 4); // If we are equal height, set our Y-look to 0 (level)

} else if(oP.coordUD > cP.coordUD)
{
UDdif = oP.coordUD - cP.coordUD; // Work out our UDdif
angleB = atan(UDdif/flatDist) * 57.29578; // Same old stuff as before
angleBP = (angleB/360);
newValueb = 0 + (0xFFFFFFFF*angleBP);
newValueb2 = newValueb;
Poke((void*)cP.lookYa, &newValueb2,4);

} else if (oP.coordUD < cP.coordUD)
{
UDdif = cP.coordUD - oP.coordUD;
angleB = atan(UDdif/flatDist) * 57.29578;
angleBP = (angleB/360);
newValueb = 0xFFFFFFFF - (0xFFFFFFFF*angleBP);
newValueb2 = newValueb;
Poke((void*)cP.lookYa, &newValueb2,4);
}
}
Back to top Go down
http://www.quickfixco.webs.com
 
Aimbot Part 2
Back to top 
Page 1 of 1
 Similar topics
-
» MOTU Classics: The Thread - Part 2
» Harga Spare Part untuk motor SYM GTS/VTS 200
» 2011 SDCC MotuC items revealed!
» Hannibal Lecter's (1986-2007) DVDRip Collection
» Openingbook testing part 2

Permissions in this forum:You cannot reply to topics in this forum
 :: Public Section: Coding :: C++ :: Source Codes-
Jump to: