dreamworkAPI
Ctrl K
GitHub
libraryDocs / server / browser

server.browser

librarymenusource

The server browser library.

Functions

server.browser.addFavoriteAdds the given server address to the player's favorites.
server.browser.getPlayersQueries a server for its player list.
server.browser.isBlacklistedChecks if the server address is blacklisted by Garry's Mod.
server.browser.isFavoriteChecks if the given server address is in the player's favorites.
server.browser.pingQueries a server for its information/ping.
server.browser.queryQueries the master server for the server list.
server.browser.removeFavoriteRemoves the given server address from the player's favorites.
server.browser.requestPingStarts a query of a server for its information/ping, without waiting for it.
server.browser.requestPlayersStarts a query of a server for its player list, without waiting for it.

#server.browser.addFavorite

menusource
function server.browser.addFavorite(address?: string)

Adds the given server address to the player's favorites.

Parameters
NameTypeDescription
addressoptionalstringThe address of the server, current server if nil. ( IP:Port like 127.0.0.1:27015 )

#server.browser.getPlayers

menuasyncsource
async function server.browser.getPlayers(address: string, timeout?: ( number | false )?): server.Player[]

Queries a server for its player list.

Parameters
NameTypeDescription
addressstringThe address of the server. ( IP:Port like 127.0.0.1:27015 )
timeoutoptional( number | false )?The timeout in seconds, default is 30, false to disable the timeout.
Returns
TypeNameDescription
server.Player[]playersThe players on the server.

#server.browser.isBlacklisted

menusource
function server.browser.isBlacklisted(address: string): boolean

Checks if the server address is blacklisted by Garry's Mod.

Parameters
NameTypeDescription
addressstring
Returns
TypeNameDescription
boolean

#server.browser.isFavorite

menunodiscardsource
function server.browser.isFavorite(address?: string): boolean

Checks if the given server address is in the player's favorites.

Parameters
NameTypeDescription
addressoptionalstringThe address of the server, current server if nil. ( IP:Port like 127.0.0.1:27015 )
Returns
TypeNameDescription
booleanis_favoritetrue if the given server is in player favorites, false if not.

#server.browser.ping

menuasyncsource
async function server.browser.ping(address: string, timeout?: ( number | false )?): server.Info

Queries a server for its information/ping.

Parameters
NameTypeDescription
addressstringThe address of the server. ( IP:Port like 127.0.0.1:27015 )
timeoutoptional( number | false )?The timeout in seconds, default is 30, false to disable the timeout.
Returns
TypeNameDescription
server.InfoinfoThe server information.

#server.browser.query

menusource
function server.browser.query(data: server.QueryData)

Queries the master server for the server list.

Parameters
NameTypeDescription
dataserver.QueryDataThe query data to send to the master server.

#server.browser.removeFavorite

menusource
function server.browser.removeFavorite(address?: string)

Removes the given server address from the player's favorites.

Parameters
NameTypeDescription
addressoptionalstringThe address of the server, current server if nil. ( IP:Port like 127.0.0.1:27015 )

#server.browser.requestPing

menusource
function server.browser.requestPing(address: string, timeout?: ( number | false )?): Future<server.Info>

Starts a query of a server for its information/ping, without waiting for it.

Several requests can be awaited together with futures.all.

Parameters
NameTypeDescription
addressstringThe address of the server. ( IP:Port like 127.0.0.1:27015 )
timeoutoptional( number | false )?The timeout in seconds, default is 30, false to disable the timeout.
Returns
TypeNameDescription
Future<server.Info>futureThe future of the server information.

#server.browser.requestPlayers

menusource
function server.browser.requestPlayers(address: string, timeout?: ( number | false )?): Future<server.Player[]>

Starts a query of a server for its player list, without waiting for it.

Several requests can be awaited together with futures.all.

Parameters
NameTypeDescription
addressstringThe address of the server. ( IP:Port like 127.0.0.1:27015 )
timeoutoptional( number | false )?The timeout in seconds, default is 30, false to disable the timeout.
Returns
TypeNameDescription
Future<server.Player[]>futureThe future of the player list.
Generated from the dreamwork meta branch.