Skip to content

Server Authentification

Note

All of these functions are only exposed to the UI VM.

These are functions required for the ingame server browser and the authorization process for the Masterserver and game servers.

Masterserver Authentification

bool NSIsMasterServerAuthenticated()

Returns true if the client is authenticated with the Masterserver

bool NSMasterServerConnectionSuccessful()

Returns true if a successful connection has been established

Game Server Authentification

void NSTryAuthWithServer( int serverIndex, string password = "" )

Tries authing with the fetched server at serverIndex and the provided password

bool NSIsAuthenticatingWithServer()

Returns true if the client is currently authing with a game server

bool NSWasAuthSuccessful()

Returns true if the client successfully authed with a game server

void NSConnectToAuthedServer()

Tries to connect to the game server that has previously been authenticated with

string NSGetAuthFailReason()

Returns the API reason why the last authentification failed

void NSTryAuthWithLocalServer()

Tries to authenticate with the local game server

void NSCompleteAuthWithLocalServer()

Call this after NSWasAuthSuccessful returns true to complete the local authorization process.

Server Information

void NSRequestServerList()

Start fetching all available game servers from the Masterserver

bool NSIsRequestingServerList()

Returns true if the last request by

int NSGetServerCount()

Returns the total amount of fetched game servers

void NSClearRecievedServerList()

Clears all fetched game servers

array NSGetGameServers()

Returns an array of all available Servers fetched from the Masterserver.

Connection Callbacks

void AddConnectToServerCallback( void functionref( ServerInfo ) callback )

Add a callback to be executed right before connecting to a game server via the Server Browser

void RemoveConnectToServerCallback( void functionref( ServerInfo ) callback )

Remove a function object from the list of callbacks

void TriggerConnectToServerCallbacks()

Runs all callbacks that have been registered with AddConnectToServerCallback

Script Structs

ServerInfo

Contains all info about a game server.

int index

Index of the native Object equivalent

string id

ID assigned to the game server by the Masterserver in the registration

string name

Name of this game server

string description

Description of this game server

string map

Unlocalized name of the map that's currently running on the game server

string playlist

Unlocalized name of the playlist that's currently running on the game server

int playerCount

The total amount of players currently connected to the player

int maxPlayerCount

The maximum amount of players that can connect to the server

bool requiresPassword

If true an extra password is required to connect to the server. Otherwise the password is an empty string

string region

Unlocalized region where the physical server is located

array requiredMods

Array of all mods that are required to be loaded on the client to be able to join the server

RequiredModInfo

Information of a mod that has to be loaded on the client in order to join a game server

string name

Name of the mod

string version

Version of the mod