
Cheat Engine The Official Site of Cheat Engine

View previous topic :: View next topic 
Author 
Message 
Kewun Cheater Reputation: 0
Joined: 18 Sep 2016 Posts: 34

Posted: Tue Feb 13, 2018 5:34 am Post subject: Aimbot Failure 


I am creating a aimbot for GTA: Vice City
The problem I have is in the Video
https://www.youtube.com/watch?v=3vLjWPSgepA
When I stand in other position of the enemy, It aims somewhere else
Code: 
CPed * target = FindPlayerPed()>m_apNearPeds[0];
auto distanceXZ = sqrtf(powf(target>GetPosition().x  FindPlayerPed()>GetPosition().x, 2) + powf(target>GetPosition().z  FindPlayerPed()>GetPosition().z, 2));
auto f_z = atan2f((target>GetPosition().y)  FindPlayerPed()>GetPosition().y, distanceXZ);
auto f_x = atan2f((target>GetPosition().z)  FindPlayerPed()>GetPosition().z, distanceXZ);
f_z = f_z;
f_x = f_x;
patch::SetFloat(0x7E48BC, f_x  0.19, true);//leftright
patch::SetFloat(0x7E48CC, f_z, true); //updown

This is the code i use, any Idea what is wrong? Maybe incorrect maths? someone can help me? [/code]


Back to top 


elmarcia How do I cheat? Reputation: 0
Joined: 13 Feb 2018 Posts: 2

Posted: Tue Feb 13, 2018 8:06 am Post subject: 


Don't know how axis are defined in GTA but i'll assume Y is where gravity is applied for this example.
(x,y,z)
Lets say you are at pos (1,1,1), and your enemy is at (3,1,4).
If you want to look at your target you need to find the angle between those two points. Note that in this example you are at the same height as your enemy, so we will only cover rotation on plane XZ.
So following my perfect drawing in paint we got.
dx = 2 (TargetX  playerX)
dz = 3 (TargetZ  playerZ)
the angle between those two is atan(dz/dx) but this will only work with the first quadrant, that means we will have to apply transformations to get the correct angle in every quadrant, luckily for us we got atan2(y,x) that does all the work for us.
So our aim angle in xz or rotation around xz will be
atan2(dz,dx), this function will return an angle in radians, make sure to convert to degrees if the rotation is in degrees in your game.
This should fix your rotation around plane XZ.
Can't post urls , but i will attach my drawing
Description: 

Filesize: 
11.83 KB 
Viewed: 
542 Time(s) 



Back to top 


Kewun Cheater Reputation: 0
Joined: 18 Sep 2016 Posts: 34

Posted: Tue Feb 13, 2018 8:41 am Post subject: 


Did not really understand.. Maybe I am noob in trigonometry
You said that
dx = 2 (TargetX  playerX)
dz = 3 (TargetZ  playerZ)
But what are those 2 and 3 ? multiplies ?


Back to top 


elmarcia How do I cheat? Reputation: 0
Joined: 13 Feb 2018 Posts: 2

Posted: Wed Feb 14, 2018 6:20 am Post subject: 


No, is the difference between your enemy position and yours.
Supose your enemy is at (3,1,4) anda you at (1,1,1)
The difference between those points result in (3,1,4)  (1,1,5)
Then dx = 3  1 , dy = 1  1, dz = 4  5
Resulting
dx = 2, dy = 0, dz = 1
Those are random values for this example.
dz = target>GetPosition().z  FindPlayerPed()>GetPosition().z
dz = same for x


Back to top 




You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum

