• serverlist.Query()?
    5 replies, posted
I wanted to know how serverlist.Query() works/is used? I saw it on the wiki and it would be quite useful for me, but it outputs a lua error, as it being a unknown library? Is it still/yet available or what? [url]http://wiki.garrysmod.com/page/serverlist/Query[/url] [url]http://wiki.garrysmod.com/page/Structures/ServerQueryData[/url] By the way, I dont know how to make the urls have these gmod wiki images so yeah.
The serverlist library is only available in the menu state. If you try to call it clientside or serverside, the library will not exist, which is why you are receiving that error. As for making it have the image next to it, click the link icon next to the colored square that represents the state: [IMG]http://i.imgur.com/TU04HNM.png[/IMG]
[QUOTE=AK to Spray;48087291]The serverlist library is only available in the menu state. If you try to call it clientside or serverside, the library will not exist, which is why you are receiving that error.[/QUOTE] is there a way to get the library available client-/serverside? Since it would make it easier to apply query on a Derma
[QUOTE=whitestar;48087337]is there a way to get the library available client-/serverside? Since it would make it easier to apply query on a Derma[/QUOTE] No. The menu state is separate from the client state for several very good reasons. A cheap work around could be create a concommand in the menu state that saves the query results in a file, and notify the client to check the file using gm_ROC, but I'm guessing you want to use this either on a server, or distribute it, in which case I doubt there is a feasible method.
I believe you can use a socket module to request a server list from the master server. I have seen it done in the [URL="https://github.com/glua/luaserverbrowser/blob/master/lua/util.lua"]luaserverbrowser[/URL]. Granted, this is quite a bit more complicated than using one simple function, but it's the only thing I can think of.
To build upon AK to Spray's post, here's a link to the [URL="https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol"]valve documentation of the master servers[/URL]. The work looks like its already done for you in the link he provided, but this is in case you want to know what's going on in the code.
Sorry, you need to Log In to post a reply to this thread.