[SNIPPET] Get Aim Target Actor

This is a old version. Use the new one which i will post later. This function has useless loops and lags ur game.
This gets the first player, who is the closest to your crosshair.
You can add your own filters to skip some players.

Code:
//0AB1: @GET_AIM_TARGET_ACTOR 1 IN_RADIUS_FROM_CROSSHAIR 400.0 _STORE_TO 0@
:GET_AIM_TARGET_ACTOR
FOR 28@ = 0.0 TO 0@ STEP 8.0
    0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
    000A: 29@ += 0x4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    for 30@ = 0 to 35584 step 0x100
        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
        000A: 29@ += 0x1
        if and
            0029:  31@ >= 0x00 
            001B:  0x80 > 31@
        then 
            005A: 31@ += 30@
            if
            056D:   actor 31@ defined
            then
                if
                803C: $PLAYER_ACTOR == 31@ // (int)
                then
                04C4: store_coords_to 27@ 26@ 25@ from_actor 31@ with_offset 0.0 0.0 0.0
                068D: get_camera_position_to 24@ 23@ 22@
                    if and { PUT YOUR CHECKS RIGHT BELOW THIS...}
                    06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 1 actor 0 object 1 particle 0
                    80DF:   actor 31@ driving
                    8118:   actor 31@ dead 
                    02CB:   actor 31@ bounding_sphere_visible 
                    then
                            04C4: store_coords_to 10@ 11@ 12@ from_actor 31@ 0.0 0.0 0.0  
                            0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 10@ Y 11@ Z 12@ store_screen_X_to 13@ Y_to 14@
                            0509: 15@ = distance_between_XY 339.1 179.1 and_XY 13@ 14@
                            if
                            0035:   28@ >= 15@ // (float) 
                            then
                                0AB2: 1 31@       
                            end  
                    end
                end
            end
        end
    end

END
0AB2: 1 -1

//0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@
:getScreenXYFrom3DCoords
0AC7: 14@ = var 0@ offset
0AC7: 15@ = var 3@ offset
0AC7: 16@ = var 6@ offset
0AC7: 17@ = var 9@ offset
0AA5: call 0x70CE30 num_params 6 pop 6 {18@ 18@} 0 0 17@ 16@ 15@ 14@
0007: 12@ = 640.0
0007: 13@ = 448.0
0A8D: 14@ = read_memory 0xC17044 size 4 virtual_protect 0
0A8D: 15@ = read_memory 0xC17048 size 4 virtual_protect 0
0093: 14@ = integer 14@ to_float
0093: 15@ = integer 15@ to_float
0073: 12@ /= 14@
0073: 13@ /= 15@
006B: 3@ *= 12@
006B: 4@ *= 13@
0AB2: ret 2 3@ 4@
 

TheZeRots

Expert
Joined
Dec 21, 2013
Messages
1,247
Reaction score
1
Re: Get Aim Target Actor

Opcode.eXe link said:
This gets the first player, who is the closest to your crosshair.
You can add your own filters to skip some players.

Code:
//0AB1: @GET_AIM_TARGET_ACTOR 1 IN_RADIUS_FROM_CROSSHAIR 400.0 _STORE_TO 0@
:GET_AIM_TARGET_ACTOR
FOR 28@ = 0.0 TO 0@ STEP 8.0
    0A8D: 29@ = read_memory 0xB74490 size 4 virtual_protect 0
    000A: 29@ += 0x4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    for 30@ = 0 to 35584 step 0x100
        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
        000A: 29@ += 0x1
        if and
            0029:  31@ >= 0x00 
            001B:  0x80 > 31@
        then 
            005A: 31@ += 30@
            if
            056D:   actor 31@ defined
            then
                if
                803C: $PLAYER_ACTOR == 31@ // (int)
                then
                04C4: store_coords_to 27@ 26@ 25@ from_actor 31@ with_offset 0.0 0.0 0.0
                068D: get_camera_position_to 24@ 23@ 22@
                    if and { PUT YOUR CHECKS RIGHT BELOW THIS...}
                    06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 1 actor 0 object 1 particle 0
                    80DF:   actor 31@ driving
                    8118:   actor 31@ dead 
                    02CB:   actor 31@ bounding_sphere_visible 
                    then
                            04C4: store_coords_to 10@ 11@ 12@ from_actor 31@ 0.0 0.0 0.0  
                            0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 10@ Y 11@ Z 12@ store_screen_X_to 13@ Y_to 14@
                            0509: 15@ = distance_between_XY 339.1 179.1 and_XY 13@ 14@
                            if
                            0035:   28@ >= 15@ // (float) 
                            then
                                0AB2: 1 31@       
                            end  
                    end
                end
            end
        end
    end

END
0AB2: 1 -1

//0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@
:getScreenXYFrom3DCoords
0AC7: 14@ = var 0@ offset
0AC7: 15@ = var 3@ offset
0AC7: 16@ = var 6@ offset
0AC7: 17@ = var 9@ offset
0AA5: call 0x70CE30 num_params 6 pop 6 {18@ 18@} 0 0 17@ 16@ 15@ 14@
0007: 12@ = 640.0
0007: 13@ = 448.0
0A8D: 14@ = read_memory 0xC17044 size 4 virtual_protect 0
0A8D: 15@ = read_memory 0xC17048 size 4 virtual_protect 0
0093: 14@ = integer 14@ to_float
0093: 15@ = integer 15@ to_float
0073: 12@ /= 14@
0073: 13@ /= 15@
006B: 3@ *= 12@
006B: 4@ *= 13@
0AB2: ret 2 3@ 4@

To implement this into poor aim would be nice. Oh, you already have, haven't you? You sneaky son of a gun!
 
Top