Skip to content

Selecting a server

dex edited this page Jan 15, 2022 · 2 revisions

To auto select a server you can simply call the #UpdateServerIdAsync method, this method has only been tested on an account with one server, it should automatically fetch the id of the first server found and then automatically call the #SelectServer method. It seems like you can only control one server at a time.

To manually get the server id you can call the #GetServerIdAsync method:

var response = await aternosClient.GetServerIdAsync();
if (response.Failed()) return;
var serverId = response.GetValue();

To manually select a server you have to call the #SelectServer method providing the server id:

aternosClient.SelectServer("<SERVER ID>");

As mentioned before this process can be automated by just calling the #UpdateServerIdAsync method:

var response = await aternosClient.UpdateServerIdAsync();
if (response.Failed()) {
  Console.WriteLine("Failed to update sever id!");
  return;
}

The return value false indicates that the method failed to automatically fetch a valid server id.

Clone this wiki locally