-- Check if the player has been on the server before, if so, then load his profile.
function OldUser( Player )
local ID = Player:UniqueID()
local ID_SUB = string.gsub(ID, ":", "-")
if !file.Exists("Profiles/Saves/"..Player:UniqueID()..".txt") then
return false
else
return true
end
end
--Load the profile.
function LoadStuff(Player)
local ID = Player:UniqueID()
local Name = "Profiles/Saves/"..Player:UniqueID()..".txt"
if file.Exists(Name) then
Players[ID] = util.KeyValuesToTable(file.Read(Name))
end
end
--Save the profile.
function SaveStuff(Player)
local ID = Player:UniqueID()
local Name = "Profiles/Saves/"..Player:UniqueID()..".txt"
file.Write(Name, util.TableToKeyValues(Players[ID]))
end
function AutoSave()
for K, V in pairs(player.GetAll()) do
SaveStuff(V)
end
end
timer.Create("Save", 30, 0, AutoSave)