String problem when using DIALOG_STYLE_TABLIST_HEADERS - 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)
+--- Thread: String problem when using DIALOG_STYLE_TABLIST_HEADERS (
/showthread.php?tid=575930)
String problem when using DIALOG_STYLE_TABLIST_HEADERS -
Darkwood17 - 31.05.2015
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.
Re: String problem when using DIALOG_STYLE_TABLIST_HEADERS -
Jefff - 31.05.2015
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;
}
Re: String problem when using DIALOG_STYLE_TABLIST_HEADERS -
Darkwood17 - 31.05.2015
Thanks to Jefff +1