CLEO Help [LOCK] Show something on the minimap. [LOCK]

CLEO related
Status
Not open for further replies.

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Hi.

I would like to make a cleo that show some specific SAMP_Vehicule_ID on the minimap. (Exemple: For RP server, faction vehicules have constant samp_veh_id. so If [samp_veh_id] is stream then Show this [sam_veh_id] with position on the Minimap.

I have the car handle and the samp_veh_id, I need to show it on the map.

-------- First Try --------

I tried to do it with marker. It's cool but 32 marker is not enought and it's a mess when car pass from streamed to out stream.


------- Second Try -------

This Snippet can convert 3D Pos to 2D on screen http://ugbase.eu/snippets/convert-3d-position-to-2d-radar-screen-pos/

and show the samp_veh_id with it

03F0: enable_text_draw 1
0342: enable_text_draw_centered 1
0340: set_text_draw_RGBA 180 180 180 255
045A: draw_text_1number 1@ 2@ GXT 'NUMBER' number 3@  // ~1~

(with 1@ 2@ XY pos on screen and 3@ the samp veh id)

BUT, it's not enought Accurate because I can't configure it well. My RADAR_POS is approximatly good, as the Distance_multiplier, but their is a major problem: "When you are on car, the minimap ZOOM or UNZOOM so it fuck all the settings.

-------- Third try -----

I was thinking if their is any way to get the "MARKER POSITION ON THE MINIMAP". So the logic would be:

Put_marker_at_this_car.
Get the ON SCREEN coord of the marker to 1 2
Disable_marker_of_this_car
Draw [samp_veh_id] at 1 2


---- Fourth Try ----

Will be yours if you give me a solution to my problem.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Re: Show something on the minimap.

me6gB7P.jpg


Something like this would do the thing? The markers on the map are not zoom-adjusted so they are not very accurate at high speed, but the overall system is quite effective
 

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Re: Show something on the minimap.

Exacly. I insipired myself from this objectfinder to show it on the map ^^

Instead of red/blue/yellow bubble..., i would like it to show the samp_veh_id.

I am on GTA IV HUD, I got something a bit good (not very accurate) with "radar pos" 203 639 and a "distance multiplier" 0,49.

It work a bit but as you said, the velocity change the map zoom, so I asked on another thread and sprinfield gave me this to controle the map zoom

http://ugbase.eu/snippets/convert-3d-position-to-2d-radar-screen-pos/msg69846/#msg69846

Could you block the map zoom ? Because 075B: set_radar_zoom 1@ doesn't work for me.

That would help me a lot, because if you do that all i will have to do is calibrate the distance multiplier.

I got all other information i need (veh_id, show number with gtx on pos x y, etc...)


Any other solution to get the onscreen coord of a marker ? (look first message, section: "third try")
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Re: Show something on the minimap.

I tried to get radar zoom level by using the mod by silent but I can't do it. 0x5794971 (or 0x5796971 for other GTA version) contains some kind of it, but it only gives the right result if the zoom is caused by entering (not driving) the car or pressing "t" button while using his mod, otherwise it shows default value even if there is a noticeable zoom. I also tried to check the near addresses in range of 50 but nothing seems to contain the actual zoom level. By increasing permamently the value of 0x5794971 the zoom becomes weird. It's stable most of the time, but when you decelerate it zooms-in for a moment and then automatically goes back to the higher value, it doesn't look good.

Check it by yourself, 0+9 sets the zoom value to 350 (180 is default)
Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA:  is_samp_available

0AB1: @VersionType 0 _returnedValue 10@
if 10@ == 1
then
10@ = 5794971  //  when enter car = 5794971 
else
10@ = 5796971
end 


:First
wait 0
if and
key_down 48
key_down 57
then     
    if 10@ == 5794971
    then    
    0A8C: write_memory 5794971 size 4 value 350.0 virtual_protect 1 
    0A8C: write_memory 5794943 size 4 value 350 virtual_protect 1  
    else
    0A8C: write_memory 5796971 size 4 value 350.0 virtual_protect 1 
    0A8C: write_memory 5796943 size 4 value 350 virtual_protect 1
    end
wait 1000
end

if 10@ == 5794971
then
0A8D: 21@ = read_memory 5794971 size 4 virtual_protect 0   
0A8D: 22@ = read_memory 5794943 size 4 virtual_protect 0   
0AD1: show_formatted_text_highpriority "%f %d" time 1000 21@ 22@ 
else
0A8D: 21@ = read_memory 5796971 size 4 virtual_protect 0   
0A8D: 22@ = read_memory 5796943 size 4 virtual_protect 0 
0AD1: show_formatted_text_highpriority "%f %d" time 1000 21@ 22@  
end 
jump @First


//0AB1: @VersionType 0 _returnedValue 1@
:VersionType
0A8D: 0@ = read_memory 5794971 size 4 virtual_protect 0 
if 0@ == 180.0 
then
1@ = 1
else
1@ = 0
end
0AB2: 1 1@


About your third try I don't get it. If you'd like to avoid usage of markers because there's not enough of them, you can just store vehicle's position(00AA: store_car 0@ position_to 3@ 4@ 5@) and convert it to 2d screen position by using the following snippet:
http://ugbase.eu/snippets/convert-3d-position-to-2d-screencords/


There's also another way which is not perfect but it's accurate enough to me. Adjusting the position of the drawn radar markers by speed check of the actor. Exponentiated proportion(speed/position) and max speed limited to 50 units provide reliable result.

Code:
06AC: 21@ = actor $PLAYER_ACTOR movement_speed
    if 0021:   21@ > 50.0
    then
    21@ = 50.0
    end
006B: 21@ *= 21@ 
17@ = -0.514 //by adjusting this you change how big is compensation of the position due to speed
0017: 17@ /= 2500.0
006B: 17@ *= 21@ 
000B: 17@ += 1.0

//17@ = distance multiplier

I forgot to say, above scripts were tested using:
-Cleo 4.1
-Samp Functions 5.1
-MG Functions impossible 4.3
-SA-MP 0.3z R1
 

Grubitsh

Active member
Joined
Jul 28, 2014
Messages
104
Reaction score
0
Re: Show something on the minimap.

Ok for the method by silent.

for the third try, the key is to understand that the marker is only here to get the marker coord onscreen. You destroy that marker as soon as you get the coord. So only 1 marker could make the job for all cars.

-create marker
-get position of marker on screen
-disable marker
-show number gtx blablabla...

Anyway, for the snippet http://ugbase.eu/snippets/convert-3d-position-to-2d-screencords/
it works well but it's not what I want, because this snippet show you the 3D coord onscreen. I used it in my personnal finder. It show the position of the target ONSCREEN, instead of the minimap like the normal finder (by thermal I think).

I will try to make it with your idea of checking speed then adjust the distance mutliplier.

THanks guys.
 
Status
Not open for further replies.
Top