Show numerical ping in scoreboard

This commit is contained in:
Federico Cecchetto 2022-04-08 18:48:27 +02:00
parent 44b372f967
commit 60d864366c

View File

@ -1,7 +1,30 @@
if (LUI.mp_hud.Scoreboard) then
if (game:issingleplayer() or Engine.InFrontend()) then
return
end
function luiglobals.GetPartyMaxPlayers()
return Engine.GetDvarInt("sv_maxclients")
end
LUI.mp_hud.Scoreboard.maxPlayersOnTeam = luiglobals.GetTeamLimitForMaxPlayers(luiglobals.GetPartyMaxPlayers())
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