11.03.2018, 18:08
I don't believe you can format in the strcat function.
You can continue using format in your case. The first line needs to be the header line, separate the headers with \t, add \n at the end of the line, pass the string to the dialog and you're good.
I think this should work for you. I added the formatting for the first line and then just added tabs to your string.
You can continue using format in your case. The first line needs to be the header line, separate the headers with \t, add \n at the end of the line, pass the string to the dialog and you're good.
I think this should work for you. I added the formatting for the first line and then just added tabs to your string.
PHP код:
CMD:top10(playerid, params[])
{
new gString[900];
mysql_query(g_SQL, "SELECT * FROM players WHERE `respect` > 0 ORDER BY `respect` DESC LIMIT 10");
new rows = cache_num_rows();
if (rows)
{
format(gString, sizeof(gString), "{ff99cc}Nickname\t{ffffff}Respect\tKills\n", get_name, get_respect, get_kills);
for (new i = 0; i < rows; i ++)
{
new get_name[MAX_PLAYER_NAME], get_respect = 0, get_kills = 0;
cache_get_value(i, "username", get_name, MAX_PLAYER_NAME);
cache_get_value_int(i, "respect", get_respect);
cache_get_value_int(i, "kills", get_kills);
format(gString, sizeof(gString), "%s{ff99cc}%s\t{ffffff}(%d)\t(%d)\n", gString, get_name, get_respect, get_kills);
}
ShowPlayerDialog(playerid, DIALOG_TOP, DIALOG_STYLE_TABLIST_HEADERS, "Top 10 LSDM players", gString, "Ok", "");
format(gString, sizeof(gString), "{99ff66}(INFO) %s ( %d ) is viewing /top10 table.", PlayerName[playerid], playerid);
SendClientMessageToAll(-1, gString);
}
return 1;
}