[SNIPPET] Get Target CAR

Code:
{ EXAMPLE:
    if
    0AB1: @GET_TARGET_CAR 0 _STORE_TO 0@
    then
        0186: 1@ = create_marker_above_car 0@
        wait 500
        0164: disable_marker 1@
    end
    by OpcodeXe
}    
:GET_TARGET_CAR
8@ = 0 {GOT_CAR?,FALSE}
if
0AE2: 0@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 99999.0 find_next 0 pass_wrecked 0
then
    REPEAT
        if
        00DF:   actor $PLAYER_ACTOR driving
        then
            03C0: 7@ = actor $PLAYER_ACTOR car
            else
            7@ = -1
        end
        0407: store_coords_to 1@ 2@ 3@ from_car 0@ with_offset 0.0 0.0 0.0
        0AB1: @getScreenXYFrom3DCoords 3 3D_coords_X 1@ 2@ 3@ _to X 4@ Y 5@
        03F0: enable_text_draw 1
        //038E: draw_box_position 320.0 200.0 size 50.0 50.0 RGBA 0 0 0 100 {TARGET_SPOT_POINT}
        0509: 6@ = distance_between_XY 320.0 200.0 and_XY 4@ 5@
        if  and
        803B: 0@ == 7@ NOT_MY_CAR
        02CA: 0@ IN_VIEW
        6@ < 50.0 { ITS NEAR MY TARGET_SPOTTER POINT }
        then
            8@ = 1 {GOT_CAR?,TRUE}
            break
        end   
    UNTIL 8AE2: 0@ = random_vehicle_near_point 0.0 0.0 0.0 in_radius 99999.0 find_next 1 pass_wrecked 0
end
if
8@ == 0
then
    059A:  return_false
else 
    0485:  return_true
end
0AB2: 1 0@

//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@
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: Get Target CAR

yum didn't get it , is it give you the coords of nearest player car around you , is it sync?
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Re: Get Target CAR

blackHat link said:
yum didn't get it , is it give you the coords of nearest player car around you , is it sync?

It will get the car you're aiming at.
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: Get Target CAR

springfield link said:
[quote author=blackHat link=topic=6567.msg44052#msg44052 date=1402509476]
yum didn't get it , is it give you the coords of nearest player car around you , is it sync?

It will get the car you're aiming at.
[/quote]

Ok but how i use it in cleo i mean what is the output of this code so i can use this output in cleo is it coords like 1@ 2@ 3@ or car id like 1@ or $car
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
Re: Get Target CAR

It gets the nearest car you're aiming at to a variable.
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: Get Target CAR

Aha so give you domething like this

The cre you are aiming at = 1@  or $car


:D NICE ,could be  useful  in some points
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
Get target car when aiming...
PHP:
:GET_TARGET_CAR
{
    0AB1: @GET_TARGET_CAR 1 FOV 50.0 store_into_ 0@
}
0087: 28@ = 0@ // (float)
0A8D: 29@ = read_memory 0xB74494 size 4 virtual_protect 0
29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
for 30@ = 0 to 27904 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 and
        044B:   actor $PLAYER_ACTOR on_foot
        056E:   car 31@ defined
        then
            0407: store_coords_to 27@ 26@ 25@ from_car 31@ with_offset 0.0 0.0 0.0   
            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
if
056E:   car 15@ defined
then
    0485:  return_true
else
    059A:  return_false
end
0AB2: 1 15@

:getScreenXYFrom3DCoords
{
    0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@
}
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@
 
Top