garrysmod-requests
garrysmod-requests copied to clipboard
Function for checking that server is under password
Details
Once sv_password has been added to the list of convars that Lua cannot read, there is no normal way to know that the server is under password. Yes, you can file.Read server.cfg or wait for the first run of CheckPassword (but in my case it is needed at server startup, before any connection), but these are all unnecessary workarounds.
It would be nice to have a simple function like
bool game.IsPasswordSet()
What are you needing this for? good addition but there could be a solution
bool game.HasPassword()
sounds better
i personally prefer game.IsPasswordProtected()
also imo this should be a shared function (at least if it doesn't need to be networked)