Hi. I'm trying to detect when a lobby has connected to the server. In CSGO/TF2 there's apparently cl_connectmethod which you can query for "matchmaking" but this cvar is nonexistant in L4D2.
Detecting if one client connected through a lobby would suffice to what I'm trying to achieve. I can't check for lobby reservation id because there is none (l4dtoolz is running).
I tried doing this, until I realized sv_hosting_lobby never changes so it won't work. Any help is appreciated.
Code:
ConVar lobby;
public void OnPluginStart()
{
lobby = FindConVar("sv_hosting_lobby"); // Does this change to 1 when a lobby connects? Apperently not.
lobby.AddChangeHook(OnLobbyConnection);
}
public void OnLobbyConnection(ConVar cvar, const char[] oldVal, const char[] newVal)
{
if (StringToInt(newVal) > 0)
{
LogMessage("Lobby detected");
}
}