Color tag in dialog problem
#1

Hello,

I'm formatting this string with color tags. Everything works fine, accept for that only the first 2 colors are working.
it shows Gold, Silver, but not Bronze

code:
Код:
	for(new bp; bp<BEST_PLAYERS_AMOUNT; bp++)
	{
	    if(BestPlayers[bp] != -1)
	    {
			GetPlayerName(BestPlayers[bp], name, sizeof name);
			if(!PlayerRoundDeaths[BestPlayers[bp]])
			{
			    ratio = 0;
			}
			else
			{
				ratio = floatdiv(PlayerRoundKills[BestPlayers[bp]], PlayerRoundDeaths[BestPlayers[bp]]);
			}
			if(bp == 0) { color = COLOR_BEST_PLAYER_FIRST; }
			if(bp == 1) { color = COLOR_BEST_PLAYER_SECOND; }
			if(bp == 2) { color = COLOR_BEST_PLAYER_THIRD; }
			if(bp >= 3) { color = COLOR_BEST_PLAYER_REST; }
			format(String, sizeof String, "%s\n{%s}#%i\t%i\t%i\t%i\t%.2f\t%s[%i]", String, color ,bp+1, PlayerRoundScore[BestPlayers[bp]], PlayerRoundKills[BestPlayers[bp]], PlayerRoundDeaths[BestPlayers[bp]], ratio, name, BestPlayers[bp]);
	    }
	}
(don't look at the ratio stuff, it's not important here)

somewhere further in the code:
Код:
				ShowPlayerDialog(i, 4, DIALOG_STYLE_MSGBOX, "End of round", String, "ok", "");
and at the top:
Код:
#define COLOR_BEST_PLAYER_FIRST		"FFD900" //Gold
#define COLOR_BEST_PLAYER_SECOND	"CFD8D7" //Silver
#define COLOR_BEST_PLAYER_THIRD		"DCDCDC" //Bronze
#define COLOR_BEST_PLAYER_REST		"FFFFFF" //White
.
Reply
#2

pawn Код:
#define COLOR_BEST_PLAYER_THIRD     "DCDCDC" //Bronze
This is silver aswell.
Reply
#3

Colors are not strings, they are hex. Try to replace the second '%s' in your format with either %h or %d.
Reply
#4

indeed it's silver too
made a copy-paste mistake :P


Vince,

I am using the colors as string, and that works perfect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)