Embedded colour codes with format(); -
Jonesy96 - 06.07.2016
Hi all,
I've been looking all over for how to do this, but cant seem to find anything anywhere to help me crack it. I'm trying to embed colour codes into a string using format. My code is below:
Код:
#define EMBED_WHITE "{FFFFFF}"
#define EMBED_WHITESMOKE "{F5F5FF}"
format(string, sizeof(string), "%x%s: %x%s",EMBED_WHITE, fullName(playerid, false), EMBED_WHITESMOKE, text);
However, unfortunately it's just outputting like below:
Any ideas? Thanks
Re: Embedded colour codes with format(); -
Stinged - 06.07.2016
Код:
format(string, sizeof (string), ""EMBED_WHITE"%s: "EMBEND_WHITESMOKE"%s", fullName(playerid, false), text);
Re: Embedded colour codes with format(); -
AbyssMorgan - 06.07.2016
change %x -> %s
Re: Embedded colour codes with format(); -
SickAttack - 06.07.2016
format(string, sizeof(string), ""#EMBED_WHITE"%s: "#EMBED_WHITESMOKE"%s", fullName(playerid, false), text);
Re: Embedded colour codes with format(); -
Farzam - 06.07.2016
Just add your colors like this example
Quote:
new string[128];
format(string, sizeof string, "{00ff00}Hello %s" , pName(playerid));
|
So it will send a message saying hello to player with color lime green.
Hope I helped you.
Re: Embedded colour codes with format(); -
Jonesy96 - 06.07.2016
Thanks very much, repped
Re: Embedded colour codes with format(); [NEW ISSUE] -
Jonesy96 - 06.07.2016
Hi again all,
I now have a further issue relating to this. In my chatlog (so what will be the player's chatlog) you can see the colour codes. How do I get rid of this? It currently shows:
Код:
[19:32:16] {FFFFFF}Joe Bloggs: {F5F5FF}Test
[19:32:18] {A3A3A3}(([0] Joe Bloggs: Test))
Re: Embedded colour codes with format(); -
SickAttack - 06.07.2016
You can't.
Re: Embedded colour codes with format(); -
WrathOfGenesis - 07.07.2016
If you want to read it in the chat log, you'll need to format the string again without the colour brackets, and print ( ) it