SA-MP Forums Archive
Color embedding in formatted text? - 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 embedding in formatted text? (/showthread.php?tid=481240)



Color embedding in formatted text? - sim_sima - 14.12.2013

Hey everyone.
I just starting scripting a bit.
I can not get color embedding to work in formatted messages like this one:
pawn Код:
format(diastr, sizeof(diastr), "{FFFF00FF}Requested username: {FFFFFFAA}%s\n\nEnter a Password to register",name);
It will not embed the colors - it just writes the string as it is.


Re: Color embedding in formatted text? - Zamora - 14.12.2013

Quote:
Originally Posted by sim_sima
Посмотреть сообщение
pawn Код:
(diastr, sizeof(diastr), "{FFFF00FF}Requested username: {0xFFFFFFAA}%s\n\nEnter a Password to register",name);
FFFF00FF it must be at least 6 letters and remove 0x.

Edit: Check this http://html-color-codes.info/


Re: Color embedding in formatted text? - Stinged - 14.12.2013

Use the hex color in { }
Example: "{FF000}test" = test


Re: Color embedding in formatted text? - sim_sima - 14.12.2013

Thank you both, I will try


Re: Color embedding in formatted text? - sim_sima - 14.12.2013

Thank you, it worked.
I am wondering how much space a color-embedding takes inside an array? Do you know that?


Re: Color embedding in formatted text? - arakuta - 14.12.2013

The same space as they occupy inside the string.

Example:

pawn Код:
new HnR[12] = "{FFFFFF}Hi!"; // 8 + 3 + 1 = 12 cells :)
// Color embeding: 8 cells
// Hi!: 3 cells
// EOS: 1cell



Re: Color embedding in formatted text? - sim_sima - 14.12.2013

Quote:
Originally Posted by arakuta
Посмотреть сообщение
The same space as they occupy inside the string.

Example:

pawn Код:
new HnR[12] = "{FFFFFF}Hi!"; // 8 + 3 + 1 = 12 cells :)
// Color embeding: 8 cells
// Hi!: 3 cells
// EOS: 1cell
Thank you