Garry's Mod Wiki

serverlist.Query

  serverlist.Query( table data )

Description

Queries the master server for server list.

Arguments

1 table data
The information about what kind of servers we want. See ServerQueryData structure

Example: Setting up this function

Showcasing how to utilize this function

local data = { Type = "internet", GameDir = "garrysmod", AppID = 4000, Callback = function(ping,name,desc,map,players,maxplayers,botplayers,pass,lastplayed,address,gamemode,workshopid,isanon,version,localization,gmcategory) print("Callback worked") end, CallbackFailed = function (address) print("callback failed") end, Finished = function () print("Finished") end, } serverlist.Query(data)
Output: console will print either the "worked" callback function or the "failed" callback function