Merge pull request 'Only save/load files for the server' (#6) from Lonsfor/srb2k-leaderboard:lonsfor-patch-3 into master
Reviewed-on: #6
This commit is contained in:
commit
1d4eb423d6
@ -272,8 +272,9 @@ local function stat_str(stat)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Read the leaderboard
|
-- Read the leaderboard
|
||||||
local f = io.open(FILENAME, "r")
|
if isserver then
|
||||||
if f then
|
local f = io.open(FILENAME, "r")
|
||||||
|
if f then
|
||||||
for l in f:lines() do
|
for l in f:lines() do
|
||||||
-- Leaderboard is stored in the following tab separated format
|
-- Leaderboard is stored in the following tab separated format
|
||||||
-- mapnum, name, skin, color, time, splits, flags, stat
|
-- mapnum, name, skin, color, time, splits, flags, stat
|
||||||
@ -324,8 +325,9 @@ if f then
|
|||||||
|
|
||||||
sortScores()
|
sortScores()
|
||||||
f:close()
|
f:close()
|
||||||
else
|
else
|
||||||
print("Failed to open file: ", FILENAME)
|
print("Failed to open file: ", FILENAME)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function allowJoin(v)
|
function allowJoin(v)
|
||||||
@ -1315,6 +1317,7 @@ local function saveTime(player)
|
|||||||
StatTrack = true
|
StatTrack = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if isserver then
|
||||||
local f = assert(io.open(FILENAME, "w"))
|
local f = assert(io.open(FILENAME, "w"))
|
||||||
if f == nil then
|
if f == nil then
|
||||||
print("Failed to open file for writing: " + FILENAME)
|
print("Failed to open file for writing: " + FILENAME)
|
||||||
@ -1339,6 +1342,7 @@ local function saveTime(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
f:close()
|
f:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- DEBUGGING
|
-- DEBUGGING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user