Only save/load files for the server

This commit is contained in:
Lonsfor 2022-08-24 19:25:53 +02:00
parent a840a5fa83
commit 518e9f7893
1 changed files with 71 additions and 67 deletions

View File

@ -257,8 +257,9 @@ local function stat_str(stat)
end
-- Read the leaderboard
local f = io.open(FILENAME, "r")
if f then
if isserver then
local f = io.open(FILENAME, "r")
if f then
for l in f:lines() do
-- Leaderboard is stored in the following tab separated format
-- mapnum, name, skin, color, time, splits, flags, stat
@ -309,8 +310,9 @@ if f then
sortScores()
f:close()
else
else
print("Failed to open file: ", FILENAME)
end
end
function allowJoin(v)
@ -1259,6 +1261,7 @@ local function saveTime(player)
StatTrack = true
end
if isserver then
local f = assert(io.open(FILENAME, "w"))
if f == nil then
print("Failed to open file for writing: " + FILENAME)
@ -1283,6 +1286,7 @@ local function saveTime(player)
end
f:close()
end
end
-- DEBUGGING