SA-MP Forums Archive
rgb to message hex code - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: rgb to message hex code (/showthread.php?tid=424975)



rgb to message hex code - EV007 - 24.03.2013

hey, how could I convert i.e 255 10 38 to hex code for SendClientMessage? The {rrggbb} code?


Re: rgb to message hex code - Vince - 24.03.2013

pawn Код:
new
    color[9],
    red = 255,
    green = 10,
    blue = 38;

format(color, sizeof(color), "{%02x%02x%02x}", red, green, blue);
That would probably work.

Edit: Otherwise, if you want the actual value, you can use this:

pawn Код:
new
    red = 255,
    green = 10,
    blue = 38;

new color = red << 24 | green << 16 | blue << 8 | 0xFF;



Re: rgb to message hex code - EV007 - 24.03.2013

yeah,that will work,forgot such thing even existed