SA-MP Forums Archive
Color 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: Color to hex (/showthread.php?tid=486322)



Color to hex - aboa - 08.01.2014

how I can convert this color 0xC2A2DAFF to hex
like {FFFFFF}


Re: Color to hex - ScRipTeRi - 08.01.2014

{C2A2DA}


Re: Color to hex - Wizzy951 - 08.01.2014

pawn Код:
stock RGBAToHex(r, g, b, a) //By Betamaster
{
    return (r<<24 | g<<16 | b<<8 | a);
}

stock HexToRGBA(colour, &r, &g, &b, &a) //By Betamaster
{
    r = (colour >> 24) & 0xFF;
    g = (colour >> 16) & 0xFF;
    b = (colour >> 8) & 0xFF;
    a = colour & 0xFF;
}
or

This one.


Re: Color to hex - Beckett - 08.01.2014

Quote:

how I can convert this color 0xC2A2DAFF to hex
like {FFFFFF}

If you wanna do it yourself then take the number between the 0x and the FF(or whatever is the last symbol)

Example:
0xC2A2DAFF --> 0xC2A2DAFF --> {C2A2DA}


Re: Color to hex - aboa - 08.01.2014

thank you all guys!