fix return typo + simplify code

This commit is contained in:
WantedDV 2023-05-19 15:13:15 -02:30
parent 2e84b3e675
commit 0d9cfc050c

View File

@ -1,23 +1,14 @@
local getModeInfo = function() local modeInfo = LobbyData:UITargetFromId(Engine.GetLobbyUIScreen())
local id = Engine.GetLobbyUIScreen() local maxClients = modeInfo.maxClients
return LobbyData:UITargetFromId(id)
end
local getMaxClients = function()
local modeInfo = getModeInfo()
return modeInfo.maxClients
end
-- Disable setting party privacy in menu. Auto set to open + max. -- Disable setting party privacy in menu. Auto set to open + max.
Engine.SetDvar("partyprivacyenabled", 0) Engine.SetDvar("partyprivacyenabled", 0)
Engine.SetDvar("tu4_partyprivacyuseglobal", 0) Engine.SetDvar("tu4_partyprivacyuseglobal", 0)
Engine.SetDvar("tu4_partyprivacyluacheck", 0) Engine.SetDvar("tu4_partyprivacyluacheck", 0)
local maxClients = getMaxClients()
-- Fix for invisible bots in custom games -- Fix for invisible bots in custom games
if maxClients >= 1 then if maxClients >= 1 then
return Engine.SetDvar("party_maxplayers", maxClients) Engine.SetDvar("party_maxplayers", maxClients)
end end
if not Engine.IsInGame() then if not Engine.IsInGame() then