CLEO Help Convert player's color into the same coloured text

CLEO related
Status
Not open for further replies.

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Hi, I'm trying to find a way to make the %s (4@) text having the same colour as the player 1@ nickname, the rest of the text should be white.
Code:
0B37: samp 5@ = get_player_color 1@
AD1: show_formatted_text_highpriority "%s %d %d" time 2000 4@ 2@ 3@
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
AD1: show_formatted_text_highpriority "~w~THIS IS WHITE~r~ - ~g~%s ~b~%d~g~%d" time 2000 4@ 2@ 3@

we use ~color letter~
to color the text
for your question i think we make it
~5@~
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Unfortunately it doesn't work, I found a way to do it by manually getting the type of colour and if that color occurs set similar text colour. But it's a pain in the ass to check all the colour values in the server, especially if there's an easier way to do it
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
It seems like it successfully gets the color of a specific player, I checked it by making a condition for a specific colour. The only problem I have is to set the same colour of the text. Placing ~5@~ before the text doesn't work somehow.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Code:
0D94: draw_text 4@ pos_xy 13@ 14@ align_xy 0.5 0.0 color 5@ shadow 1
This solved the problem, thank you for replies:)
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
monday link said:
Code:
0D94: draw_text 4@ pos_xy 13@ 14@ align_xy 0.5 0.0 color 5@ shadow 1
This solved the problem, thank you for replies:)

good :)
thx for replying the solve code , you helped many ppl

you're welcome :)
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
I was trying to use this one but I found that I can't draw 2 texts at once, am I doing something wrong?
Code:
:Show_target_health
wait 0
if
0AD2: 0@ = player $PLAYER_CHAR targeted_actor
jf @Show_target_health
0B2B: samp 1@ = get_player_id_by_actor_handle 0@
0B25: samp 2@ = get_player_health 1@
0B26: samp 3@ = get_player_armor 1@
0B36: samp 4@ = get_player_nickname 1@
0B37: samp 5@ = get_player_color 1@
00A0: store_actor 0@ position_to 10@ 11@ 12@
0B55: convert_3D_coords 10@ Y 11@ Z 12@ to_screen 13@ 14@ 
03F0: enable_text_draw 1    
0D94: draw_text 4@ pos_xy 13@ 14@ align_xy 0.5 0.0 color 5@ shadow 1
14@+=15 
wait 2000 

 // code works well until here. I added "wait 2000" to check where is the problem

0D94: draw_text 2@ pos_xy 13@ 14@ align_xy 0.5 0.0 color 5@ shadow 1
jump @Show_target_health

Edit: When the mod reaches the last opcode the chat shows warnings about exceptions and the game stops
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
Code:
0B25: samp 2@ = get_player_health 1@

2@ is integer not text. 0D94 only draws strings. So use
Code:
0AD3: 31@ = format "%d" 2@
0D94: draw_text 31@ pos_xy 13@ 14@ align_xy 0.5 0.0 color 5@ shadow 1
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Big thanks for help, works well:) Btw I had to add "v" letter to 31@ in both opcodes (so it was 31@v), without it the game was crashing.
 
Status
Not open for further replies.
Top