Help Help me with AIM_AT_POS snippet

Polaroid

Active member
Joined
Oct 30, 2014
Messages
39
Reaction score
0
Code:
{$CLEO .cs}
0000:

WHILE TRUE
    WAIT 0
    IF 0AD2: 0@ = player $PLAYER_CHAR targeted_actor
    THEN
        Actor.StorePos(0@, 1@, 2@, 3@)
        0AB1: @AIM_AT_POS 4 XYZ: 1@ 2@ 3@ ADD_CAMERA_OFFSET 0.04253
    END
END
//0AB1: @AIM_AT_POS 3 XYZ: 1@ 2@ 3@
:AIM_AT_POS
0087: 8@ = 3@
068D: get_camera_position_to 3@ 4@ 5@
0063: 0@ -= 3@
0063: 1@ -= 4@
0604: get_Z_angle_for_point 0@ 1@ store_to 6@
6@ -= 90.0
0017: 6@ /= 57.2957795            
005B: 6@ += 8@  // (float)                           
0A8D: 7@ = read_memory 0xB6F248 size 4 virtual_protect 0
0A25: set_camera_on_players_X_angle 7@ Z_angle 6@
0661: "by Opcode.eXe | UGBASE.EU"
0AB2: 0

Hello. I've been trying to add a smoothing factor to this snippet for HOURS now but I can't get it to work. I tried dividing the angle difference by 2.0 but it aims completely off. I don't know what I am doing wrong. Can somebody please guide me on how to add a smoothing factor to this particular snippet or give me some helpful advice? Thank you
 

Codex1337

Active member
Joined
Mar 1, 2014
Messages
170
Reaction score
1
call @AIM_AT_PLAYER 1 $PLAYER_HANDLE


Code:
:AIM_AT_PLAYER
Actor.StorePos(0@, 1@, 2@, 3@)
068D: get_camera_position_to 4@ 5@ 6@
0063: 1@ -= 4@
0063: 2@ -= 5@
0604: get_Z_angle_for_point 1@ 2@ store_to 6@
6@ -= 90.0
0017: 6@ /= 57.2957795                                      
0A8D: 7@ = read_memory 0xB6F248 size 4 virtual_protect 0
0A25: set_camera_on_players_X_angle 7@ Z_angle 6@
0AB2: 0
 

Polaroid

Active member
Joined
Oct 30, 2014
Messages
39
Reaction score
0
Codex1337 said:
call @AIM_AT_PLAYER 1 $PLAYER_HANDLE


Code:
:AIM_AT_PLAYER
Actor.StorePos(0@, 1@, 2@, 3@)
068D: get_camera_position_to 4@ 5@ 6@
0063: 1@ -= 4@
0063: 2@ -= 5@
0604: get_Z_angle_for_point 1@ 2@ store_to 6@
6@ -= 90.0
0017: 6@ /= 57.2957795                                      
0A8D: 7@ = read_memory 0xB6F248 size 4 virtual_protect 0
0A25: set_camera_on_players_X_angle 7@ Z_angle 6@
0AB2: 0

I'm trying to make the aiming smooth (slower). I tried this and it snaps to the target too. Do you know how I would go about making it smooth? Thank you!
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
Polaroid said:
I'm trying to make the aiming smooth (slower). I tried this and it snaps to the target too. Do you know how I would go about making it smooth? Thank you!

What about getting the distance between crosshair and a target, then segment (simple "for" loop) it by smooth value + add wait\sleep to prevent perfomance drops because speed of aiming will be simply based on your fps
Obstler's smooth have this error, so when you'll have big fps (like 120+) smooth speed will be f up, as well as if you will have lower fps
sry for my ingris, didn't sleep for 30 hours
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,488
Reaction score
231
Location
( ͡° ͜ʖ ͡°)
You need:
YourCurrentAngles and CalculatedAngles


Then remove YourCurrentAngles from the CalculatedAngles and devide it by 20.0 or whatever and add this value to YourCurrentAngles again
 

Polaroid

Active member
Joined
Oct 30, 2014
Messages
39
Reaction score
0
Okay so I divided the angle difference by 10.0 and made a FOR loop (1 to 10) to += to my current angle and aim to it 10 times to reach my target. Now I'm having trouble with adding a wait between each of the 10 increments I aim at. If I try doing "wait 1" after each increment the screen jitters around like crazy and aims at at random spots left and right. I think I need to add a timer wait (32@) but I don't know how to do this in a FOR loop after each time it aims?

Basically i did something like this

newAngle = currentAngle
targetAngle -= currentAngle
targetAngle /= 10.0
for 1 to 10
newAngle += targetAngle
setCamera on currentAngle to newAngle
end

and that works fine. It aims to player but now i cant figure out how to add a WAIT or timer in there to make it smooth
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
Polaroid said:
Okay so I divided the angle difference by 10.0 and made a FOR loop (1 to 10) to += to my current angle and aim to it 10 times to reach my target. Now I'm having trouble with adding a wait between each of the 10 increments I aim at. If I try doing "wait 1" after each increment the screen jitters around like crazy and aims at at random spots left and right. I think I need to add a timer wait (32@) but I don't know how to do this in a FOR loop after each time it aims?

Basically i did something like this

newAngle = currentAngle
targetAngle -= currentAngle
targetAngle /= 10.0
for 1 to 10
  newAngle += targetAngle
  setCamera on currentAngle to newAngle
end

and that works fine. It aims to player but now i cant figure out how to add a WAIT or timer in there to make it smooth

set 32@ to 0 and add while 32@ < time_in_ms?
if you don't understand how 32@ and 33@ works, you can simply debug them (number draw for example)
 

Polaroid

Active member
Joined
Oct 30, 2014
Messages
39
Reaction score
0
Opcode.eXe said:
You dont need a "for loop" to make smooth.

1@ = currentangle
2@ = aimbot angle
2@ -= 1@
2@ /= 10.0
2@ += 1@

how do I get my camera's current Z angle from the memory so I can use it in 1@? Thank you
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
[shcode=cpp]

{$CLEO .cs}
0000:

while true
    wait 0
    if 0AD2: 0@ = player $PLAYER_CHAR targeted_actor
    then
        Actor.StorePos(0@, 1@, 2@, 3@)
        068D: get_camera_position_to 4@ 5@ 6@
        0063: 1@ -= 4@
        0063: 2@ -= 5@
        0604: get_Z_angle_for_point 1@ 2@ store_to 6@ //target angle
        
        while 6@ < 0.0 
            6@ += 360.0
        end
           
        6@ -= 90.0
        6@ /= 57.295776
       
        6@ += 0.04253 // adding offset for crosshair to line up
        
        0A8D: 7@ = readMem 0xB6F248 size 4 vp 0  //vertical angle
        0A8D: 8@ = readMem 0xB6F258 size 4 vp 0  //horizontal angle
              
        0087: 9@ = 8@
        0063: 9@ -= 6@  //diff
        
        while 9@ <= -3.14159 // i have a pi
            9@ += 6.28318    // i have a pi * 2
        end                  // ugh, normalized
        
        while 9@ > 3.14159
            9@ -= 6.28318
        end
        
        //gta frame time, use in order to be consistent with FPS
        0A8D: 5@ = readMem 0xB7CB5C size 4 vp 0 
        5@ *= 0.1 //smooth mult.
        
        006B: 9@ *= 5@ 
        0063: 8@ -= 9@
        
        0A25: set_camera_on_players_X_angle 7@ Z_angle 8@ 
    end
end 
[/shcode]

Should work, kinda.. maybe.
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
springfield said:
[shcode=cpp]

{$CLEO .cs}
0000:

while true
    wait 0
    if 0AD2: 0@ = player $PLAYER_CHAR targeted_actor
    then
        Actor.StorePos(0@, 1@, 2@, 3@)
        068D: get_camera_position_to 4@ 5@ 6@
        0063: 1@ -= 4@
        0063: 2@ -= 5@
        0604: get_Z_angle_for_point 1@ 2@ store_to 6@ //target angle
        
        while 6@ < 0.0 
            6@ += 360.0
        end
           
        6@ -= 90.0
        6@ /= 57.295776
       
        6@ += 0.04253 // adding offset for crosshair to line up
        
        0A8D: 7@ = readMem 0xB6F248 size 4 vp 0  //vertical angle
        0A8D: 8@ = readMem 0xB6F258 size 4 vp 0  //horizontal angle
              
        0087: 9@ = 8@
        0063: 9@ -= 6@  //diff
        
        while 9@ <= -3.14159 // i have a pi
            9@ += 6.28318    // i have a pi * 2
        end                  // ugh, normalized
        
        while 9@ > 3.14159
            9@ -= 6.28318
        end
        
        //gta frame time, use in order to be consistent with FPS
        0A8D: 5@ = readMem 0xB7CB5C size 4 vp 0 
        5@ *= 0.1 //smooth mult.
        
        006B: 9@ *= 5@ 
        0063: 8@ -= 9@
        
        0A25: set_camera_on_players_X_angle 7@ Z_angle 8@ 
    end
end 
[/shcode]

Should work, kinda.. maybe.

        while 6@ < 0.0 
            6@ += 360.0
        end

This ever happens? :O

Btw, you're sick at aimbot calculation, sad I've been sleeping at geometry maths back while xd
Took me 4 hours to figure out how to get Z angle for point in C++ that equals 0604 opcode, well done mate, helped me a lot

P.S. While I was figuring out how to get Z angle the opcode's quote "Springfield, he niggered some aimbot movement calculations" didn't get out of my head all the time xddddd
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
No, opcode 0604 already does that.

[shcode=cpp]
angle = atan(x, y)  * 57.295776 - 90.0;
do
   angle = angle + 360.0;
while ( angle < 0.0 );
[/shcode]

I just converted a c++ aimbot logic and integrated it into opcode.exe snippet.

supahdupahnubah said:
P.S. While I was figuring out how to get Z angle the opcode's quote "Springfield, he niggered some aimbot movement calculations" didn't get out of my head all the time xddddd


:eek:key:
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
springfield said:
No, opcode 0604 already does that.

[shcode=cpp]
angle = atan(x, y)  * 57.295776 - 90.0;
do
   angle = angle + 360.0;
while ( angle < 0.0 );
[/shcode]
Yea I know it, I've tried to do it at C++
Where did ya find that formula? Straight from CLEO src or what? I did it different way and the calculations were the same :O 

kk got it

BTW This is my first time I've been playing around with the calculations, so as it's first try, I've converted your source to C++ and it was aiming glitchy until I've put some debug messages to the chat (lol?) and changed 5@ *= 0.1 multiplier to 0.001
I can record it if you interested to help me, if not, gonna fix it tomorrow by myself but with different calculations ;c
Gonna test this formula out tomorrow, shiet, I really have to get some geometry classes again >.<
 
Top