RGB color code
#1

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.
Reply
#2

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
Reply
#3

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..
Reply
#4

I suggest you read this:

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


Forum Jump:


Users browsing this thread: 1 Guest(s)