Merge pull request #364 from fedddddd/scoreboard-ping

Show numerical ping in scoreboard
This commit is contained in:
Maurice Heumann 2022-04-10 10:08:53 +02:00 committed by GitHub
commit 4bffbedd6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,30 @@
if (LUI.mp_hud.Scoreboard) then
function luiglobals.GetPartyMaxPlayers()
return Engine.GetDvarInt("sv_maxclients")
end
LUI.mp_hud.Scoreboard.maxPlayersOnTeam = luiglobals.GetTeamLimitForMaxPlayers(luiglobals.GetPartyMaxPlayers())
if (game:issingleplayer() or Engine.InFrontend()) then
return
end
function luiglobals.GetPartyMaxPlayers()
return Engine.GetDvarInt("sv_maxclients")
end
local scoreboard = LUI.mp_hud.Scoreboard
scoreboard.maxPlayersOnTeam = luiglobals.GetTeamLimitForMaxPlayers(luiglobals.GetPartyMaxPlayers())
scoreboard.scoreColumns.ping = {
width = Engine.IsZombiesMode() and 90 or 60,
title = "LUA_MENU_PING",
getter = function (scoreinfo)
return scoreinfo.ping == 0 and "BOT" or tostring(scoreinfo.ping)
end
}
local getcolumns = scoreboard.getColumnsForCurrentGameMode
scoreboard.getColumnsForCurrentGameMode = function(a1)
local columns = getcolumns(a1)
if (Engine.IsZombiesMode()) then
luiglobals.table.insert(columns, scoreboard.scoreColumns.ping)
end
return columns
end