CLEO Help meters

CLEO related

daki

Active member
Joined
Oct 11, 2019
Messages
38
Reaction score
5
Location
Serbia
hi , i am making a script which will locate objects/pickups in meters, i am working in sanny builder so i need to know how to make it , example "Gift is near , ... meters"
i tried with (~%f~) but its show only 0 meters when i walk or something else..

here is mine example: printf "~R~Paketic ~W~Je ~W~U ~R~Okolini ~n~(~%f~) metara" time 1 9@
9@ = 0
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Maybe like this:
PHP:
// 0@ contains the object handle
01BB: store_object 0@ position_to 1@ 2@ 3@
00A0: store_actor $PLAYER_ACTOR position_to 4@ 5@ 6@
050A: 1@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@
// 1@ now contains the distance between 3D points(float)
0AD1:   show_formatted_text_highpriority "Object Distance: %f" time 100 1@
 

daki

Active member
Joined
Oct 11, 2019
Messages
38
Reaction score
5
Location
Serbia
now is spamming warnings in chat, and when is %f it doesn't show the meters, but when i put in the brackets like this (%f) then its show only 0 meters
 

daki

Active member
Joined
Oct 11, 2019
Messages
38
Reaction score
5
Location
Serbia
oh yea i fixed now , but now its showing this numbers idk why
and yea when i put time 100 1@ its showing again 0 , but 100 9@ its showing like in this picture
 

Attachments

  • 1641227661839.png
    1641227661839.png
    453.2 KB · Views: 42
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
It's hard to guess what causes your problem, I bet there is something out there:
  • You forgot to pass the object handle to 0@. If you have the Object/Pickup ID, make sure to retrieve this object/pickup's handle. Try using either of these opcodes:
PHP:
0B50: samp 0@ = object_handle_by_id 748 // 748 is the object ID
// Or... If it's a pickup
0B51: samp 0@ = pickup_handle_by_id 748 // 748 is the pickup ID
  • You used/passed wrong Variables during the retrieval of the distance value.
  • interrupting the variables during the distance value retrieval?

. You might as well post the whole code here so that we can examine.
 
Top