HEX Conversion. - 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: HEX Conversion. (
/showthread.php?tid=194766)
HEX Conversion. -
Zh3r0 - 30.11.2010
Is there a function that converts HEX to RGB ? The new color codes we use in messages. ?
Like HEXtoRGB( ... )
Re: HEX Conversion. -
Zh3r0 - 30.11.2010
Quote:
Originally Posted by ******
What do you mean by hex? Hex is a numeric representation of numbers, so if you do:
You can do:
pawn Код:
format(str, sizeof (str), "{%06x}text", COLOR>>>8);
That will correctly format the colors in a string from a number. Or do you have a string representation of colour?
|
What i want is to convert player's color into the new code format. { }
BTW, nice usage :O
Re: HEX Conversion. -
Zh3r0 - 30.11.2010
Quote:
Originally Posted by ******
In that case the code I already posted will do:
pawn Код:
format(str, sizeof (str), "{%06x}text", GetPlayerColor(playerid) >>> 8);
The "06" in the x specifier may not be required. It isn't in RC1 as short colour codes are valid ({FF} is blue), but I know long codes ({FFAA4455}) are invalid in RC3, I've not yet had a chance to retest short codes.
|
Wow, thank you very much ******, you are a savior!
Re: HEX Conversion. -
Pghpunkid - 05.11.2011
[necrothread]I <3 Search Button[/necrothread]
Re: HEX Conversion. -
[MWR]Blood - 05.11.2011
Quote:
Originally Posted by Pghpunkid
[necrothread]I <3 Search Button[/necrothread]
|
Seriously, why did you just bump a 1 year old topic?