Color tag in dialog problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Color tag in dialog problem (
/showthread.php?tid=205902)
Color tag in dialog problem -
ғαιιοцт - 02.01.2011
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
.
Re: Color tag in dialog problem -
_rAped - 02.01.2011
pawn Код:
#define COLOR_BEST_PLAYER_THIRD "DCDCDC" //Bronze
This is silver aswell.
Re: Color tag in dialog problem -
Vince - 02.01.2011
Colors are not strings, they are hex. Try to replace the second '%s' in your format with either %h or %d.
Re: Color tag in dialog problem -
ғαιιοцт - 02.01.2011
indeed it's silver too
made a copy-paste mistake :P
Vince,
I am using the colors as string, and that works perfect.