CLEO Help help with HEX to RGB

CLEO related
Status
Not open for further replies.

jahova

New member
Joined
Jul 8, 2015
Messages
2
Reaction score
0
Hello,
I was wondering if I could convert player color returned by get_player_color to RGB?
I am trying to write a script that shows the player's nickname colored with his color via set_text_draw functions.

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 
03F0: enable_text_draw 1 

if
    8AF7: get_samp_base_to 0@
then
    0A93: end_custom_thread
end
repeat
    wait 400
until 0AFA: is_samp_structures_available

:NAME
wait 0
0B2B: samp 3@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B36: samp 2@ = get_player_nickname 3@
0B37: samp 4@ = get_player_color 3@
033F: set_text_draw_letter_size 0.3 1.1
081C: draw_text_outline 1 RGBA 0 0 0 255
0340: set_text_draw_RGBA 255 255 255 255
0349: set_text_draw_font 3
0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'BJ_PUSH' 1@
0AA5: call 0x718600 2 pop 2 1@ 2@
033E: set_draw_text_position 548.0 30.0 GXT 'BJ_PUSH'
0AF8: samp add_message_to_chat "debug: %x" color 4@ 4@
jump @NAME
It is now showing with pre-defined color(white rgba 255 255 255 255), I want it to show with the players color.
Excuse me for any mistakes in the code, I'm a newbie at CLEO scripting.

tldr; is there a way to convert HEX color returned by SAMPFUNCS get_player_color into RGB?
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
If you use SF
Code:
0B66: render argb 1@ to_a 2@ r 3@ g 4@ b 5@
If you don't use SF use my func
http://ugbase.eu/snippets/hex-to-rgba-rgba-to-hex/
 

jahova

New member
Joined
Jul 8, 2015
Messages
2
Reaction score
0
springfield link said:
If you use SF
Code:
0B66: render argb 1@ to_a 2@ r 3@ g 4@ b 5@
If you don't use SF use my func
http://ugbase.eu/snippets/hex-to-rgba-rgba-to-hex/
You are the fucking boss man, thank you very much!
 
Status
Not open for further replies.
Top