String problem when using DIALOG_STYLE_TABLIST_HEADERS
#1

Hi,

I tried to make a command to show all players online using this code:
Код:
CMD:onlineplayers(playerid, params[])
{
	new Tabs[500], List[500];
	for (new i; i < MAX_PLAYERS; i++)
	{
		if (IsPlayerConnected(i))
		{
			format(Tabs, 500, "Player\tID\n%s\n", List);
			format(List, 500, "%s%s\t%i\n", List, GetName(i), i);
		}
	}
	if (strlen(List) > 0) ShowPlayerDialog(playerid, 1, DIALOG_STYLE_TABLIST_HEADERS, "Online Players:", Tabs, "Close", "");
	return 1;
}
I tested this with two players but it's showing only the player with the lower id.
Reply
#2

pawn Код:
CMD:onlineplayers(playerid, params[])
{
    static List[1500];

    List = "Player\tID";

    for(new i,g = GetPlayerPoolSize(); i < g+1; i++)
        if(IsPlayerConnected(i))
            format(List, sizeof(List), "%s\n%s\t%i", List, GetName(i), i);

    if(strlen(List) > 0) ShowPlayerDialog(playerid, 1, DIALOG_STYLE_TABLIST_HEADERS, "Online Players:", List, "Close", "");
    return 1;
}
Reply
#3

Thanks to Jefff +1
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)