Author Topic: Getting all servers and players on blockland  (Read 782 times)

I am wondering how do i show like all the servers up (Including dead servers).
And also all the players (Don't have to be Single game or demo players.).
I tryed echo(getServerCount());
But it wont work.

Not entirerly sure but i would recomend looking at rtb.

How would RTB have it?

Hmm well they have information and you wanted to see the players so that might have had it.

That checks a "Server",
And i want the code the get the ammount of players on "Blockland";
and ammount of the "Servers" like on the JoinServerGui,
And also i did JoinServerGui.dump(); and it didn't gave me what i wanted.

If you remember how I taught you to access ClientGroup, then this will be roughly the same, but with ServerInfoGroup. The group contains a ScriptObject for each row in the server list. Dump one of the objects in the group (after querying the master server) to check out all the fields you can access.

This is interesting.
Can you post a sample script of how to do each step Truce?

This is interesting.
Can you post a sample script of how to do each step Truce?

Each step of what? These are true for all SimGroups (unless blocked):

ServerInfoGroup.getCount() - returns number of objects in the group
ServerInfoGroup.getObject(int Index) - returns the object found at the provided index

Therefore, you could do something like:

Code: [Select]
for(%i = 0; %i < ServerInfoGroup.getCount(); %i++)
{
     %obj = ServerInfoGroup.getObject(%i);
     %name = %obj.name;
     %ping = %obj.ping;

     if(%ping !$= "Dead")
          echo("The server \"" @ %name @ "\" has a ping of: " @ %ping);
     else
          echo("The server \"" @ %name @ "\" is dead!");
}

Now is it possible to check the players in the server? And how would you get the ip address of the object you get from the ServerInfoGroup?

Now is it possible to check the players in the server? And how would you get the ip address of the object you get from the ServerInfoGroup?

Dump one of the objects and you will see that both those fields and more exist.

Dump one of the objects and you will see that both those fields and more exist.
Oh ok, but is it possible to get all of the players within a server? Not just the number of current players?

Oh ok, but is it possible to get all of the players within a server? Not just the number of current players?

It's not a default feature, but RTB contains a feature for that (i.e. when you click the "Information" button on the server list).