SA-MP Forums Archive
RGB color 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 color code (/showthread.php?tid=500429)



RGB color code - SyntaxQ - 13.03.2014

I need the exact code/formula to convert RGB (Red-Green-Blue) to Hex Color Codes (that SA-MP understands) with an example.

Any help would be appreciated.


Re: RGB color code - RajatPawar - 13.03.2014

pawn Код:
CreateRGB(r, g, b)
{  
    return ( ((r & 0xff) << 16) + ((g & 0xff) << 8) + (b & 0xff) );
}
Now you can -

pawn Код:
printf("%x", CreateRGB(255, 255, 255));
Prints FFFFFF


Re: RGB color code - SyntaxQ - 13.03.2014

Hmm, its not completely working.
When I type, /color 255 30 30 (R-G-B), it gives me green color but it should be red..


Re: RGB color code - ColeMiner - 13.03.2014

I suggest you read this:

https://sampforum.blast.hk/showthread.php?tid=200876