Hi. Here is my problem, I’m trying to get my DListView to list all of the players trails in their save data and run the command to set their trail but I must be doing it wrong. Thanks for your help. Here is my DListView code
[lua]local DermaListView = vgui.Create(“DListView”, self)
DermaListView:SetPos(15, 160)
DermaListView:SetSize(80, 200)
DermaListView:SetMultiSelect(false)
DermaListView:AddColumn(“Trails”) // Add column
for k,v in pairs(file.Read("player_trails/"..string.Replace(ply:SteamID(),":","_")..".txt")) do
DermaListView:AddLine(v)
end
function DermaListView:OnRowSelected( LineID, Line )
-- Line is a DListView_Line panel object
name = Line:GetColumnText( 1 )
RunConsoleCommand("setTrail",name)
end [/lua]
and here is how the trails are saved if it helps.
[lua]if file.Exists(“player_trails/”…string.Replace(ply:SteamID(),":","")…".txt") then
local In = file.Read(“playert_trails/”…string.Replace(ply:SteamID(),":","")…".txt")
In = string.Explode("
“,In)
ply.Trails = In;
ply.TrailLoad = true
else
ply.Trails = {}
table.insert(ply.Trails, “”)
local Out = string.Implode(”
“,ply.Trails)
file.Write(“onslaught_trails/”…string.Replace(ply:SteamID(),”:","_")…".txt",Out)
ply.TrailLoad = true
end[/lua]
Once again thanks for any help.