SA-MP Forums Archive
RGBA To Hex - 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: RGBA To Hex (/showthread.php?tid=488704)



RGBA To Hex - Opah - 18.01.2014

I Need a function in pawn that converts RGBA to hex but i can't create one i have no idea how to do it


Re: RGBA To Hex - Djole1337 - 19.01.2014

pawn Код:
stock rgb2hex(red, green, blue) return (red << 16) | (green << 8) | blue;



Re: RGBA To Hex - Opah - 19.01.2014

first of all thanx
but can u say to me how to use the hex then ??
cuz what i see returns values to each red green blue not a hex like 0xFF0000 or something


Re: RGBA To Hex - Djole1337 - 19.01.2014

printf("%x", rgb2hex(255, 0, 0));
what does it returns?


Re: RGBA To Hex - Pottus - 19.01.2014

A hex value is really an integer anyways but ya you can use the %x specifier to get the hex value in a string.


Re: RGBA To Hex - Djole1337 - 19.01.2014

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
A hex value is really an integer anyways but ya you can use the %x specifier to get the hex value in a string.
otherwise its returned in rrrgggbbb format, and yes - as an integer.


Re: RGBA To Hex - Opah - 19.01.2014

Thanx guys i got it