From 6a25f0e4aba88338ae9794536dd227e2b12dc44b Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:29:00 -0230 Subject: [PATCH] Robust com_maxclients override - now sets com_maxclients to lobby default - supports all modes --- data/ui_scripts/party/__init__.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/data/ui_scripts/party/__init__.lua b/data/ui_scripts/party/__init__.lua index 2030b7bc..a2a96f46 100644 --- a/data/ui_scripts/party/__init__.lua +++ b/data/ui_scripts/party/__init__.lua @@ -7,15 +7,17 @@ CoD.IsTeamChangeAllowed = function() end end --- Set com_maxclients InGame so players can join via direct connect -local maxclients = function() - if Engine.IsZombiesGame() then - return 4 - else - return 18 - end +local GetModeInfo = function() + local id = Engine.GetLobbyUIScreen() + return LobbyData:UITargetFromId(id) end -Engine.SetDvar( "com_maxclients", maxclients() ) +local GetMaxClients = function() + local ModeInfo = GetModeInfo() + return ModeInfo.maxClients +end + +-- Set com_maxclients InGame so players can join via direct connect (default from lobbydata) +Engine.SetDvar( "com_maxclients", GetMaxClients() ) require("DataSources_StartMenuGameOptions")