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?