[SNIPPET] RGB - HEX convertor

Well, I needed to convert the color from 0B37: samp 2@ = get_player_color 1@ to RGB...And even if I couldn't do it, I still made a progress, so here it is:

Code:
:RGBfromHEX  
//0AB1: call_scm_func @RGBfromHEX 1 0x00FF00 R 0@ G 1@ B 2@  
0085: 1@ = 0@
0085: 2@ = 0@
0085: 3@ = 0@

0016: 1@ /= 65536
0085: 4@ = 1@ //B
0012: 1@ *= 65536

0062: 2@ -= 1@
0016: 2@ /= 256
0085: 5@ = 2@ //G
0012: 2@ *= 256

0062: 3@ -= 1@
0062: 3@ -= 2@
0085: 6@ = 3@ //R
0AB2: ret 3 6@ 5@ 4@

Code:
:HEXfromRGB  
//0AB1: call_scm_func @HEXfromRGB 3 R 255 G 255 B 255 0@  
0012: 0@ *= 65536
005A: 1@ += 0@
0012: 2@ *= 256
005A: 1@ += 2@
0AB2: ret 1 1@

0B37 uses ARGB, so if anyone can make it, post it here please.
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,493
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Re: RGB - HEX convertor

Code:
0B37: samp 0@ = get_player_color 
0B66: render argb 0@ to_a 1@ r 2@ g 3@ b 4@
2@ = R
3@ = G
4@ = B
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
Re: RGB - HEX convertor

//0AB1: @nickColor 1 playerID ret_RGB 0@ 1@ 2@
Code:
:NickColor
0AA2: 3@ = "samp.dll"
000A: 3@ += 0x1FA378 
0012: 0@ *= 4 
005A: 3@ += 0@  
000A: 3@ += 3 
0A8D: 1@ = readMem 3@ sz 1 vp 1 
000E: 3@ -= 1 
0A8D: 2@ = readMem 3@ sz 1 vp 1 
000E: 3@ -= 1 
0A8D: 3@ = readMem 3@ sz 1 vp 1 
0AB2: ret 3 1@ 2@ 3@
 
Top