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