Raised This Month: $ Target: $400
 0% 

Help: PrintToConsole() executing out of order


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
nomx
Junior Member
Join Date: Sep 2010
Old 09-15-2010 , 14:58   Help: PrintToConsole() executing out of order
Reply With Quote #1

Here's the code (adapted from the sm_admins command):
Code:
public Action:Command_Users(client, args)
{
	new Usrs[64], count = 0;
	for (new i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i)) Usrs[count++] = i;
	}

	if (count)
	{
		PrintToConsole(client, "---------------------------------------------------");
		PrintToConsole(client, "ID\tSteam ID\t \tName");
		PrintToConsole(client, "---------------------------------------------------");

		decl String:name[64], String:steamid[64], userid;

		for (new i = 0; i < count; i++)
		{
			GetClientName(Usrs[i], name, sizeof(name));
			GetClientAuthString(Usrs[i], steamid, sizeof(steamid));
			userid = GetClientUserId(Usrs[i]);
			PrintToConsole(client, "%d\t%s\t%s", userid, steamid, name);
		}

		PrintToConsole(client, "---------------------------------------------------");
	}
	return Plugin_Handled;
}
However, I'm getting output like this:

Code:
] sm_users 
---------------------------------------------------
ID	Steam ID	 	Name
9	STEAM_0:0:5267961	Super Awesome Melons
---------------------------------------------------
23	STEAM_0:0:34443103	{-K-C-} Rene__
2	STEAM_0:0:9398230	Ego
24	STEAM_0:0:29023212	{-K-C-}Winerle
---------------------------------------------------

] sm_users 
---------------------------------------------------
ID	Steam ID	 	Name
---------------------------------------------------
2	STEAM_0:0:9398230	Ego
9	STEAM_0:0:5267961	Super Awesome Melons
23	STEAM_0:0:34443103	{-K-C-} Rene__
24	STEAM_0:0:29023212	{-K-C-}Winerle
---------------------------------------------------

] sm_users 
9	STEAM_0:0:5267961	Super Awesome Melons
---------------------------------------------------
23	STEAM_0:0:34443103	{-K-C-} Rene__
ID	Steam ID	 	Name
24	STEAM_0:0:29023212	{-K-C-}Winerle
---------------------------------------------------
---------------------------------------------------
2	STEAM_0:0:9398230	Ego

] sm_users 
---------------------------------------------------
24	STEAM_0:0:29023212	{-K-C-}Winerle
ID	Steam ID	 	Name
---------------------------------------------------
---------------------------------------------------
2	STEAM_0:0:9398230	Ego
9	STEAM_0:0:5267961	Super Awesome Melons
23	STEAM_0:0:34443103	{-K-C-} Rene__
It doesn't appear to want to output in the correct order. Any way to fix this?
nomx is offline
 



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

Forum Jump


All times are GMT -4. The time now is 07:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode