Lobby Server & Hiding a gamemode from the server list

Hello Facepunch,

I wanted to ask on a “better” way for Lobby servers, currently I got two ideas,

the first one, sending the player that wants to connect inside a database(which gets removed after 5 minutes for security shit), so the server the player wants to join checks if hes in the database, and if, then he is able to join, if not, gets refused.

The 2nd method I think of, is giving the server a specific password, which will be used to connect the server, but I doubt the Connect() function, nor the concommand “connect” accepts the password var? And then there would be the problem, if the player somehow can retrieve the password through the console, basically I dont want players to be able to directly join the server itself, only from the lobby server.

The 2nd question would be, is it possible to somehow make a gamemode(own one, duh), not be seen in the Serverlist? like setting GM.Name to nil or something? I wouldn’t want players to see any of my ‘lower-tier’ servers(Dont know how to properly name that), which will be used from the Lobby server, so they’d only like see the Lobby gamemode.

I hope you get what I mean, and that you maybe got better methods than my two ones for a lobby server.


Lisa out!

You could avoid the whole database thing by just creating some kind of unique key system and overriding the check password hook. i.e Taking the players steamid64 adding their UID *2 and some other random shit and then util.CRC it. If you wanted it even more beefy incorporate unix time in it so you can make keys expire in X seconds.

As for hiding it from the server browser if you own the box it runs on you could probably block the “A2S_INFO” packets to and from your server so that it won’t be discoverable

the gamemodename.txt file had some option not to list your server in gamemode if i remember right,
and you can do “connect ip;password pass” for connecting but the 1st option seems better.

I would go for either database, or sockets.
You can retrieve server passwords by typing “password” in the console, it will show the current value that you have set on the client.

You don’t need to do anything hacky.

He can just use: http://wiki.garrysmod.com/page/GM/CheckPassword

People could easily figure out the password.

You can use a mysql approach but socketing modules like http://forum.facepunch.com/showthread.php?t=1393640 are probably the best way to go.

mind posting me in the right direction for the gamemode.txt, since I only know the vars as shown in the wiki?

[editline]1st April 2016[/editline]

sure I bet socketing IS the best way, and most optimized one, but currently I just think about making it for the test sake, and later optimize it, for me I generally want everything to be working first, then I’ll look over it and optimize it.

Figuring out the password doesn’t matter.
You can basically code the hook to kick ‘unwanted guests’.

How do you tell the difference between a wanted and unwanted guest?

by checking if the client password had been supplied, if not, a server sent them.

This doesn’t make sense, but it’s your thing I guess.

clPassword is the password entered by the client, if its not set, then the user did not enter any password, and either connected without typing it in, or was sent from a server. (Sure its exploitable by sending the user from a different server without adding any checks)

Which is why it doesn’t make sense, if your goal was to make it so that players can only join from a lobby server.
That password will always be blank unless the server has a password and the user is prompted to enter one.
That password can also be retrieved as I explained above if it is set.

Just use CheckPassword hook with some networking to check if he should be connecting. Or have the server have state like “WAITING” and “ONGOING”, while waiting allow everyone and when amount is reached change the state.
And about gamemode.txt,
menusystem “Include and set to 1 if this gamemode should be selectable from the main menu”

I simply check IF the password at all IS empty, and then do a check(which includes sockets/sql)

A is the lobby, B is the server

In A, write a file of steamID64 allowed for B on the disk (B must have access to this). In B CheckPassword hook, check the steamID64 with the file, if no steamID64 in this file => return false.

the menusystem stuff is only so it is selectable(or not) from the bottom right dropdown thing next to the language setting.

SQL is asynchronous, you can’t use it via the Checkpassword hook

thats way too complicated/unoptimized, having a timer remove the ID from the file, or making the clientserver able to modify the file would be exploitable too. Better use SQL/Sockets I guess, my only problem right now still is, hiding the client gamemode server itself (if theres a other way than blocking packets)

is not the same as

Yes, checkpassword hook is the correct thing to use, but the password is irrelevant if you use sql/sockets
Infact, users might have passwords set from joining previous servers, so that should be ignored anyway.