View Single Post
Alex101192
Senior Member
Join Date: Aug 2018
Old 06-19-2020 , 20:06   Re: [REQ][PAID?][L4D2]Friends/Private lobby , Forced to public matchmaking?
Reply With Quote #4

Quote:
Originally Posted by Silvers View Post
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <left4dhooks>

ConVar sv_allow_lobby_connect_only;

public 
void OnPluginStart()
{
    
HookEvent("player_connect"Event_PlayerConnect);

    
sv_allow_lobby_connect_only FindConVar("sv_allow_lobby_connect_only");
    
sv_allow_lobby_connect_only.AddChangeHook(ConVarChanged_Cvars);
}

public 
void ConVarChanged_Cvars(Handle convar, const char[] oldValue, const char[] newValue)
{
    
sv_allow_lobby_connect_only.IntValue 0;
}

public 
void Event_PlayerConnect(Event event, const char[] namebool dontBroadcast)
{
    
int total;
    for( 
int i 1<= MaxClientsi++ )
    {
        if( 
IsClientConnected(i) && !IsFakeClient(i) )
        {
            if( 
total++ > ) return;
        }
    }

    if( 
total == )
    {
        
L4D_LobbyUnreserve();
        
PrintToServer("Lobby auto unreserved.");
    }

Seems to work.
What does this do?
Alex101192 is offline