Spoiler addhook("team","loading")
function loading(id)
if (player(id,"usgn") > 0) then
ld_data = io.open('Achievement Data/'..player(id,"usgn")..'.txt','r')
if (ld_data ~= nil) then
for line in io.lines('Achievement Data/'..player(id,"usgn")..'.txt','r') do
local parses = totable(line)
if (tonumber(parses[1]) > 0) then
ac1[id] = tonumber(parses[1])
ac2[id] = tonumber(parses[2])
ac3[id] = tonumber(parses[3])
ac4[id] = tonumber(parses[4])
ld_data:close()
end
end
else
ac1[id] = 0
ac2[id] = 0
ac3[id] = 0
ac4[id] = 0
end
end
end
addhook("attack","sav")
function sav(id)
if (player(id,"usgn") > 0) then
file = assert(io.open('Achievement Data/'..player(id,"usgn")..'.txt','w'))
file:write(ac1[id],ac2[id],ac3[id],ac4[id])
file:close()
end
end