CLEO Help Drive boat to marker

CLEO related
Status
Not open for further replies.

lerevenen1

Member
Joined
Feb 18, 2020
Messages
10
Reaction score
4
Location
France
Hi everyone, I want to make a script that drives the boat to marker, I used this snippet, but I don't manage to get it working.
So I told myself it should be outdated and tried to update it using this release but failed again.

I also tried to display player position using printf "%d %d %d" 1@ 2@ 3@ but it don't worked =/
here an image of the marker the marker position is random this is why I need to get it
So I would like to know why my printf don't work and what I missed when making this snippet with this release.

Code:
              // This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP
:fish_0
Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
printf "PLAYER POS:~B~ %d, %d", %d 1000 20@ 21@ 22@
wait 0
if and
0AB0:   key_pressed 80
04A7:   actor $PLAYER_ACTOR driving_boat
else_jump @fish_0
:fish_1
03C0: 30@ = actor $PLAYER_ACTOR car
02DB: set_boat 30@ speed_to 40.0                                             
wait 500
for 13@ = 1 to 31
    if 0AB1: @GetMarkerPosition 1 13@ 14@ 15@ 16@
    then
    02D3: boat 30@ sail_to 14@ 15@ 0.0
    end
end
jump @fish_0

:GetMarkerPosition
0085: 0@ = 13@
0@ *= 160
0@ += 13098328
0@ += 48
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
0@ += 4
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0
0@ += 4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0
0@ += 28
0A8D: 4@ = read_memory 0@ size 2 virtual_protect 0
    if and
    8043:   1@ == 0.0
    8043:   2@ == 0.0
    8043:   1@ == 1099.551025
    8043:   2@ == 1601.496948
    8043:   1@ == 2695.624023
    8043:   2@ == -1704.687988
    4@ == 1
    then
    0485:  return_true
    else
    059A:  return_false
    end
0AB2: ret 3 1@ 2@ 3@

Thanks for help
 
Last edited:

batonkal

Active member
Joined
May 6, 2017
Messages
100
Reaction score
16
Location
Bosnia and Herzegovina
PHP:
printf "PLAYER POS:~B~ %d, %d", %d 1000 20@ 21@ 22@

Try this; position is a float value, and you misplaced the quotation mark:
PHP:
printf "PLAYER POS:~B~ %.1f, %.1f, %.1f" 1000 20@ 21@ 22@
 
Last edited:

lerevenen1

Member
Joined
Feb 18, 2020
Messages
10
Reaction score
4
Location
France
Thanks for all the replies
Edited as you said at first it wasn't working and after struggling a long time I found that Sanny Builder wasn't configured correctly and solved the problem with this post
Now the player position is correctly displayed
 

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
Thanks for all the replies
Edited as you said at first it wasn't working and after struggling a long time I found that Sanny Builder wasn't configured correctly and solved the problem with this post
Now the player position is correctly displayed
May i see the code? Just wanted to use it for myself. Thanks!
 

lerevenen1

Member
Joined
Feb 18, 2020
Messages
10
Reaction score
4
Location
France
My code is awful and not finished so it never work fine, and I don't allways get the marker from long range

Code:
              // This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}
//-------------MAIN---------------
//x2503  y-2270 depart
//x3000  y-2300 get out
//x2900  y-2660 go further
0000: NOP
int $iCount = 0
18@ = Render.CreateFont("Verdana", 8, 15)
alloc 23@ 64
alloc 24@ 64
repeat
wait 100
until Samp.Available()
:fish_0
Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
format 23@ "{33FF33}POS: X%f Y%f Z%f" 20@ 21@ 22@
Render.DrawText(18@, 23@, 1055, 9, -1)
wait 0
//PRINTF "~R~PLAYER POS 8 &:~B~ %0.1f" 1 24@
if and
0AB0:   key_pressed 80   //p
04A7:   actor $PLAYER_ACTOR driving_boat
else_jump @fish_0
:fish_1
wait 0
03C0: 30@ = actor $PLAYER_ACTOR car                                     
float $fFloat = 10.0
0004: $found = 0
repeat
wait 0
Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
02D3: boat 30@ sail_to 3000.000 -2300.000 0.0
0509: 31@ = distance_between_XY 20@ 21@ and_XY 3000.000 -2300.000
format 23@ "{33FF33}POS: X%f Y%f Z%f" 20@ 21@ 22@
format 24@ "{33FF33} Distance: %f" 31@
Render.DrawText(18@, 23@, 1055, 9, -1)
Render.DrawText(18@, 24@, 1055, 30, -1)
until 0024: $fFloat > 31@
 
if and
    call @is_cp_active 0
    003c: $iCount == 0
then
    005e: $iCount += 1
    call @get_cp_pos 0 14@ 15@ 16@
    repeat
    wait 0
    Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
    0509: 31@ = distance_between_XY 20@ 21@ and_XY 14@ 15@
    format 23@ "{33FF33}POS: X%f Y%f Z%f" 20@ 21@ 22@
    format 24@ "{33FF33} Distance: %f  %f > %f" 31@ $fFloat 31@
    Render.DrawText(18@, 23@, 1055, 9, -1)
    Render.DrawText(18@, 24@, 1055, 30, -1)
    02D3: boat 30@ sail_to 14@ 15@ 0.0
    until 0024: $fFloat > 31@
else
    repeat
    wait 0
    Actor.StorePos($PLAYER_ACTOR, 20@, 21@, 22@)
    02D3: boat 30@ sail_to 2900.000 -2660.000 0.0
    0509: 31@ = distance_between_XY 20@ 21@ and_XY 3000.000 -2300.000
    format 23@ "{33FF33}POS: X%f Y%f Z%f" 20@ 21@ 22@
    format 24@ "{33FF33} Distance: %f" 31@
    Render.DrawText(18@, 23@, 1055, 9, -1)
    Render.DrawText(18@, 24@, 1055, 30, -1)
    if
        call @is_cp_active 0
    then
        0004: $found = 1
    end
    until 0039: $found == 1     
end

jump @fish_1

:is_cp_active
0AA2: 0@ = loadlib "samp.dll"
0A8E: 1@ = 0@ + 2203916//0x21A10C
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 36 //0x24
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
IF 1@ == TRUE
THEN 0485:  return_true
ELSE 059A:  return_false
END
0AA3: free_library 0@
0AB2: ret 0

:get_cp_pos
0AA2: 0@ = loadlib "samp.dll"
0A8E: 1@ = 0@ + 2203916//0x21A10C
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 12 //0xC
0A8D: 2@ = read_memory 1@ size 4 virtual_protect 0
1@ += 4  //0x4
0A8D: 3@ = read_memory 1@ size 4 virtual_protect 0
1@ += 4  //0x4
0A8D: 4@ = read_memory 1@ size 4 virtual_protect 0
0AA3: free_library 0@
0AB2: ret 3 2@ 3@ 4@
 

lerevenen1

Member
Joined
Feb 18, 2020
Messages
10
Reaction score
4
Location
France
That's what this was about, just loop through all the radar blips and filter the distinctive red marker out (0xa50000ff) you should be able to get them from outside the marker stream area aslong as it's on your radar.
http://ugbase.eu/index.php?threads/yellow-marker-coords.20957/#post-122881
Thanks for help but had already found this wich is awsome
And used MKKJ cleo to make this:
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}
//-------------MAIN---------------
0000: NOP
0B6D: render 10@ = create_font "Tahoma" height 8 flags  0x4
alloc 11@ 128
25@ = 0
while not SAMP.Available()
    wait 100
end

:wait
wait 0
if and
    0AB0: key_pressed 32//space
    0AB0: key_pressed 68//D
then
    printf "BLIP RENDERER ~B~ON" 1000
    jump @display
end
jump @wait

:display
wait 0
if and
    0AB0: key_pressed 32//space
    0AB0: key_pressed 70//F
then
    printf "BLIP RENDERER ~R~OFF" 1000
    jump @wait
end

for 29@ = 0 to 174
    0A90: 1@ = 29@ * 40 // int
    1@ += 12224240
    0A8E: 31@ = 1@ + 0 // int
    0A8D: 2@ = read_memory 31@ size 4 virtual_protect 0//+0Color ID of blip
    //0A8E: 31@ = 1@ + 4 // int  
    //0A8D: 3@ = read_memory 31@ size 4 virtual_protect 0//Handle of entity the blip is assigned to (ped/car/object, etc...)
    0A8E: 31@ = 1@ + 8 // int
    0A8D: 4@ = read_memory 31@ size 4 virtual_protect 0//X Position of blip (not working for entity blips)
    0A8E: 31@ = 1@ + 12 // int
    0A8D: 5@ = read_memory 31@ size 4 virtual_protect 0//Y Position of blip (not working for entity blips)
    0A8E: 31@ = 1@ + 16 // int
    0A8D: 6@ = read_memory 31@ size 4 virtual_protect 0//Z Position of blip (not working for entity blips)
    //0A8E: 31@ = 1@ + 20 //+20Blip Counter; How many blips have created in this blip index
    //0A8E: 31@ = 1@ + 24 //+24Unused float (leftover from GTAIII debug)
    //0A8E: 31@ = 1@ + 28 //+28Size of blip (set by opcode 0168)
    //0A8E: 31@ = 1@ + 32 //+32Pointer to streamed enex marker (assigned with opcode 08DC)
    //0A8E: 31@ = 1@ + 36 //+36Radar Icon ID
    //0A8D: 7@ = read_memory 31@ size 1 virtual_protect 0
    //0A8E: 31@ = 1@ + 37 //+37Bunch of bitflags about blip properties belowBit 0Makes use of bright colors. Always set.Bit 1Whether blip is exist or not (set by opcode 07BF)Bit 2Long Distance; If set, blips won't disappear if out of radar range.
    //0A8E: 31@ = 1@ + 38 //+38More flags about blip propertiesBit 0Show marker above entity (set by opcode 018B as 2-bit value)Bit 1Show blip on radar (set by opcode 018B as 2-bit value)Bit 2Type of assigned entity (It's a 4-bit value, not a bitflag)Airstrip
    if
        00C2: sphere_onscreen 4@ 5@ 6@  radius 3000.0
    then
        Actor.StorePos($PLAYER_ACTOR, 24@, 23@, 22@)
        0B55: convert_3D_coords 4@ 5@ 6@ to_screen 21@ 20@  
        0B55: convert_3D_coords 24@ 23@ 22@ to_screen 19@ 18@
        0B68: render draw_line_point1 21@ 20@ point2 19@ 18@ width 1 color 0x88ff3333
        0B70: render draw_polygon_pos 21@ 20@ size 3 3 corners 7 rotation 0 color 0xbaff0000                  
        050A: 12@ = distance_between_XYZ 24@ 23@ 22@ and_XYZ 4@ 5@ 6@
        format 11@ "ID:%i|COLOR:%i|DIST:%f|x:%f y:%f z:%f" 29@ 2@ 12@ 4@ 5@ 6@   //{f4f4c1}uniqId: {ffffff}%d" 31@ 15@ 14@                
        0B6F: render font 10@ draw_text 11@ pos 21@ 20@ color 0xcaf4c1c1                  
    end
end

jump @display

So I can get all the blip maker info I needed
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,113
Solutions
5
Reaction score
878
Location
Lithuania
Thanks for help but had already found this wich is awsome
And used MKKJ cleo to make this....
So I can get all the blip maker info I needed

This code return blip marker rgb from color id:
PHP:
:getColorID_RGB
0A90: 1@ = 0@ * 4 // int
000A: 1@ += 0xBAB22C
0A8D: 2@ = read_memory 1@ size 1 virtual_protect 0 // R
000A: 1@ += 1
0A8D: 3@ = read_memory 1@ size 1 virtual_protect 0 // G
000A: 1@ += 1
0A8D: 4@ = read_memory 1@ size 1 virtual_protect 0 // B
0AB2: ret 3 2@ 3@ 4@
 
Status
Not open for further replies.
Top