Raised This Month: $51 Target: $400
 12% 

Solved [L4D2] Detect when a lobby has connected.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-26-2018 , 03:43   [L4D2] Detect when a lobby has connected.
Reply With Quote #1

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");
	}
}

Last edited by Visual77; 03-26-2018 at 15:19. Reason: .
Visual77 is offline
ReCreator
Member
Join Date: Nov 2017
Location: Ukraine,Kyiv
Old 03-25-2024 , 08:47   Re: [L4D2] Detect when a lobby has connected.
Reply With Quote #2

How did you solve it?
Have the same conditions and no ideas...
__________________
Sorry for my pure English...
ReCreator is offline
ReCreator
Member
Join Date: Nov 2017
Location: Ukraine,Kyiv
Old 03-26-2024 , 11:06   Re: [L4D2] Detect when a lobby has connected.
Reply With Quote #3

Found my own solution: https://forums.alliedmods.net/showthread.php?p=2750363
After cutting all reservation stuff, Left4Dhooks Direct lobby natives starts to work.
Might be usefull for someone.
__________________
Sorry for my pure English...

Last edited by ReCreator; 03-26-2024 at 14:43.
ReCreator is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode