CLEO Help Re: Get Target CAR

CLEO related
Status
Not open for further replies.

Polaroid

Active member
Joined
Oct 30, 2014
Messages
39
Reaction score
0
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@

http://ugbase.eu/snippets/get-target-car/

Please can someone turn this snippet into a fully functioning CLEO script that shows a marker above a car that I aim at. I'm having trouble figuring out where to move the EXAMPLE code in order to get the whole thing flowing.

Forgive me, for I am noob.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Reaction score
154
Code:
{$CLEO .cs}
0000: NOP 

:First
wait 0
if
0AB1: @GET_TARGET_CAR 0 _STORE_TO 0@
then
0186: 1@ = create_marker_above_car 0@
wait 500
0164: disable_marker 1@
end
jump @First



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


{$CLEO .cs} //must be there, don't ask me why exactly because I don't know xd
0000: NOP  //same

:First  //label. You can force the code to go back to this place by using "jump @First"
wait 0 //must be under label name to avoid crash
if        //start of the "if then end" statement
0AB1: @GET_TARGET_CAR 0 _STORE_TO 0@ //condition (if you aim at the car the car handle will be stored to 0@ by using the function provided below
then
0186: 1@ = create_marker_above_car 0@ //if you aim at the car it will make the marker above it
wait 500
0164: disable_marker 1@ //disable the current marker just before creating the new one
end
jump @First //jumps at the begining of the label (the code goes back to :First and repeats the work, creates new marker and destroys it again)

That's it my friend
 
Status
Not open for further replies.
Top