[SNIPPET] GET_TARGET_ACTOR

This gets the closest player to your crosshair instandly, not like the old version.

example:
Code:
        IF
        0AB1: @GET_TARGET_ACTOR 0 0@
        THEN
            04C4: store_coords_to 1@ 2@ 3@ from_actor 0@ with_offset 0.0 0.0 0.0         
                    
        END

Code:
:GET_TARGET_ACTOR 
28@ = 640.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
                02CB:   actor 31@ bounding_sphere_visible
                06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 0 actor 0 object 1 particle 0
                then
                    0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 27@ Y 26@ Z 25@ store_screen_X_to 24@ Y_to 23@    
                    0509: 22@ = distance_between_XY 339.0 179.0 and_XY 24@ 23@ 
                    if
                    0035:   28@ >= 22@ // (float) 
                    then
                        0087: 28@ = 22@ // (float)
                        0087: 15@ = 31@ // (float)
                    end
                
                
                end     
            end
        end
    end
end
if
056D:   actor 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@
//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@
 

iLost

Well-known member
Joined
Jun 5, 2014
Messages
216
Reaction score
0
Re: GET_TARGET_ACTOR

Nice Opcode! Not bad ..  :not_bad:
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
RE: [SNIPPET] GET_TARGET_ACTOR

n1 :pPFFH: :pPFFH: :pPFFH:

@Opcode.eXe

i did a trigger bot on rifle with this ty  :pPFFH: :pPFFH: :pPFFH: :pPFFH:
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
RE: [SNIPPET] GET_TARGET_ACTOR

Opcode.eXe said:
This gets the closest player to your crosshair instandly, not like the old version.

example:
Code:
        IF
        0AB1: @GET_TARGET_ACTOR 0 0@
        THEN
            04C4: store_coords_to 1@ 2@ 3@ from_actor 0@ with_offset 0.0 0.0 0.0         
                    
        END

Code:
:GET_TARGET_ACTOR 
28@ = 640.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
                02CB:   actor 31@ bounding_sphere_visible
                06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 0 actor 0 object 1 particle 0
                then
                    0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 27@ Y 26@ Z 25@ store_screen_X_to 24@ Y_to 23@    
                    0509: 22@ = distance_between_XY 339.0 179.0 and_XY 24@ 23@ 
                    if
                    0035:   28@ >= 22@ // (float) 
                    then
                        0087: 28@ = 22@ // (float)
                        0087: 15@ = 31@ // (float)
                    end
                
                
                end     
            end
        end
    end
end
if
056D:   actor 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@
//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@


it don't works really good on m4 / rifle, could you tell me how to fix it?  :iknowwhatyoudidthere:
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
RE: [SNIPPET] GET_TARGET_ACTOR

339.0 179.0 is the 2D position of the crosshair.
maybe try to change that to the m4 crosshair cordinates?
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
RE: [SNIPPET] GET_TARGET_ACTOR

Opcode.eXe said:
339.0 179.0 is the 2D position of the crosshair.
maybe try to change that to the m4 crosshair cordinates?

330.0 190.0 for rifle

it only works with his get3d cords snippet
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
RE: [SNIPPET] GET_TARGET_ACTOR

Opcode.eXe said:
This gets the closest player to your crosshair instandly, not like the old version.

example:
Code:
        IF
        0AB1: @GET_TARGET_ACTOR 0 0@
        THEN
            04C4: store_coords_to 1@ 2@ 3@ from_actor 0@ with_offset 0.0 0.0 0.0         
                    
        END

Code:
:GET_TARGET_ACTOR 
28@ = 640.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
                02CB:   actor 31@ bounding_sphere_visible
                06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 0 actor 0 object 1 particle 0
                then
                    0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 27@ Y 26@ Z 25@ store_screen_X_to 24@ Y_to 23@    
                    0509: 22@ = distance_between_XY 339.0 179.0 and_XY 24@ 23@ 
                    if
                    0035:   28@ >= 22@ // (float) 
                    then
                        0087: 28@ = 22@ // (float)
                        0087: 15@ = 31@ // (float)
                    end
                
                
                end     
            end
        end
    end
end
if
056D:   actor 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@
//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@

HEEEEEEEEEEEEEY

i m so fcking pissed of and finally i know what's the problem with your snippet

i fkin told u its a problem with your snippet u didn't believed meeee :/

if the cond is false then script won't read this line

[shcode=cpp]0087: 15@ = 31@ // (float)[/shcode]

and as can you see at the finel lines you have cond, if actor 15 is defined then .. fuk, but if no one is bounding or another cond is false, script wont know what is that fkin 15@ var and it will give me craaash, at least i fkin fixed it
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
RE: [SNIPPET] GET_TARGET_ACTOR

There is no bug... what are you talking about??
There is even a security check to prevent false returings:
PHP:
if
056D:   actor 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@


// Show me your fix?
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
RE: [SNIPPET] GET_TARGET_ACTOR

Opcode.eXe said:
There is no bug... what are you talking about??
There is even a security check to prevent false returings:
PHP:
if
056D:   actor 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@


// Show me your fix?

u dont understand, i dont either xd but on the server where i play this snippet dont works i will show you tomorow a vid and i l give u the edited source :D
i just put a cond 

if 12@ == 1337 then if actor 15@ defined ...

and 12@ == 1337 when 15@ == 31@ (actor handle)
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
RE: [SNIPPET] GET_TARGET_ACTOR

Opcode.eXe said:
There is no bug... what are you talking about??
There is even a security check to prevent false returings:
PHP:
if
056D:   actor 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@


// Show me your fix?

[shcode=cpp]
:GET_TARGET_ACTOR 
28@ = 640.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
                02CB:   actor 31@ bounding_sphere_visible
                06BD:   no_obstacles_between 27@ 26@ 25@ and 24@ 23@ 22@ solid 1 car 0 actor 0 object 1 particle 0
                then
                    0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 27@ Y 26@ Z 25@ store_screen_X_to 24@ Y_to 23@    
                    if 02D8:   actor $PLAYER_ACTOR current_weapon == 33
                    then
                        0509: 22@ = distance_between_XY 330.0 190.0 and_XY 24@ 23@ 
                    else
                        0509: 22@ = distance_between_XY 339.0 179.0 and_XY 24@ 23@ 
                    end
                    if
                    0035:   28@ >= 22@ // (float) 
                    then
                        0087: 28@ = 22@ // (float)
                        0087: 15@ = 31@ // (float)
                        12@ = 1337
                    end                
                end     
            end
        end
    end
end
if 12@ == 1337
then
    12@ = 0
    if 056D:   actor 15@ defined
    then
        0485:  return_true
    else
        059A:  return_false
    end
end
0AB2: 1 15@
[/shcode]
on a script with 5k lines if i dont use this cond, i get crash
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
RE: [SNIPPET] GET_TARGET_ACTOR

There's no bug, you need to use the snippet like a conditional opcode,

[shcode=cpp]
if 0AB1: @GET_TARGET_ACTOR 0 0@
then
   0@ is valid ptr
end
[/shcode]
 
Top