Raised This Month: $ Target: $400
 0% 

[REQ][PAID?][L4D2]Friends/Private lobby , Forced to public matchmaking?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-19-2020 , 14:34   Re: [REQ][PAID?][L4D2]Friends/Private lobby , Forced to public matchmaking?
Reply With Quote #3

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.
__________________
Silvers is offline
 



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 04:51.


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