3 Commits

Author SHA1 Message Date
Not
c49702c33b create README.md 2022-03-28 13:27:11 +02:00
Not
6244847b81 fix ranking numbers x offset for 10, 100 2022-03-28 13:19:50 +02:00
Not
f53a6ba91f v1.2.17_hf 2022-03-28 13:16:00 +02:00
2 changed files with 8 additions and 6 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Leaderboard plugin for srb2kart
https://mb.srb2.org/addons/time-attack-leaderboard.3742/

View File

@ -121,7 +121,7 @@ local function getScoreTable(map, flags)
--return id --return id
local mode = flags & F_SPBATK local mode = flags & F_SPBATK
return lb[mode] and lb[mode][map] or {} return lb[mode] and lb[mode][map] or nil
end end
local function score_t(map, name, skin, color, time, splits, flags, restat) local function score_t(map, name, skin, color, time, splits, flags, restat)
@ -171,7 +171,7 @@ if f then
flags = tonumber(t[7]) flags = tonumber(t[7])
end end
local scoreTable = getScoreTable(tonumber(t[1]), flags) local scoreTable = getScoreTable(tonumber(t[1]), flags) or {}
local spl = {} local spl = {}
if t[6] != nil then if t[6] != nil then
@ -766,10 +766,10 @@ local function drawScroll(v, player, scoreTable, gui)
end end
local x = 10 local x = 10
if #scoreTable > 10 then if #scoreTable >= 10 then
x = x + 8 x = x + 8
end end
if #scoreTable > 100 then if #scoreTable >= 100 then
x = x + 8 x = x + 8
end end
@ -865,7 +865,7 @@ end
-- Find location of player and scroll to it -- Find location of player and scroll to it
function scroll_to(player) function scroll_to(player)
local m = getScoreTable(gamemap, Flags) local m = getScoreTable(gamemap, Flags) or {}
scrollToPos = 2 scrollToPos = 2
for pos, score in ipairs(m) do for pos, score in ipairs(m) do
@ -879,7 +879,7 @@ function scroll_to(player)
end end
local function saveTime(player) local function saveTime(player)
local scoreTable = getScoreTable(gamemap, Flags) local scoreTable = getScoreTable(gamemap, Flags) or {}
local newscore = score_t( local newscore = score_t(
gamemap, gamemap,