Hey FacePunch
I’m making a private gamemode for my server, but has a problem i need to have a file, can’t use mysql or database, that keeps all info about players. All info would in the beginning be: time played on server, player name and player steamid. I tried to make a little code that check at first spawn if it know the player if not write new line with the info but it doesn’t write anything, what could be the problem?:
function GM:PlayerInitialSpawn( ply )
self.BaseClass:PlayerInitialSpawn( ply )
textdata = file.Read("TTcomRP/playedtime.txt")
lines = string.Explode("
", textdata)
// Now let's loop through all the lines so we can split those too
for i, line in ipairs(lines) do
// line is the current line, and i is the current line number
data = string.Explode(";", line)
playersteam = data[1]
playername = data[2]
playertotaltime = data[3]
end
if playersteam == ply:SteamID() then
-- Nothing
else
values = { ply:GetName(), ply:SteamID(), 0 } // create a new table with our required values
data = string.Implode(";", values)
file.AppendLine("playerdata.txt", data)
end
end