SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/05/2015, 01:19 AM   #1
Darkwood17
Huge Clucker
 
Join Date: Oct 2014
Posts: 309
Reputation: 52
Default String problem when using DIALOG_STYLE_TABLIST_HEADERS

Hi,

I tried to make a command to show all players online using this code:
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.
Darkwood17 is offline   Reply With Quote
Old 31/05/2015, 01:29 AM   #2
Jefff
High-roller
 
Join Date: Dec 2007
Posts: 2,599
Reputation: 303
Default Re: String problem when using DIALOG_STYLE_TABLIST_HEADERS

Code:
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;
}
Jefff is online now   Reply With Quote
Old 31/05/2015, 09:41 AM   #3
Darkwood17
Huge Clucker
 
Join Date: Oct 2014
Posts: 309
Reputation: 52
Default Re: String problem when using DIALOG_STYLE_TABLIST_HEADERS

Thanks to Jefff +1
Darkwood17 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
String problem! cnoopers Scripting Help 10 22/03/2015 02:08 PM
SII String problem Lidor124 Scripting Help 1 29/12/2014 09:04 PM
String problem [..MonTaNa..] Scripting Help 11 01/06/2013 06:26 PM
Yet another string problem DobbysGamertag Scripting Help 4 23/04/2013 11:30 PM
PROBLEM STRING! NEED HELP! TwisTa98 Scripting Help 3 01/12/2012 10:44 AM


All times are GMT. The time now is 02:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.