Hey All, Just wondering if you can help me with a slight problem that I cannot figure out.
[lua]
ply:SetTeam(tbl.team)
ply:SetModel(tbl.model)
[/lua]
Ok basically the problem is I have a data file saved and it does correctly show the exact file path to select the model but unfortunately its not setting a players model and to make things worse I am getting no errors, It works perfectly for setting a players team from the data file.
Here is my data file:
[quote]
"Out"
{
"model" "models/player/group01/male_07.mdl"
"team" "24"
"name" "Jazora"
}
[/quote]
If anyone can help it will be much appreciated.
[lua]
local tbl = util.KeyValuesToTable(file.Read("path/to/file.txt"))
[/lua]
[lua]
local tbl = util.KeyValuesToTable(file.Read("GamemodeTest/"..ply:UniqueID()..".txt"))
[/lua]
Already got it Thanks
Still the same problem? Anyone got any ideas?
Posting full code always helps
[QUOTE=|King Flawless|;21539925]Posting full code always helps[/QUOTE]
My If Statement for loading:
[lua]
if file.Exists("GamemodeTest/"..ply:UniqueID()..".txt") then
local tbl = util.KeyValuesToTable(file.Read("GamemodeTest/"..ply:UniqueID()..".txt"))
ply:SetTeam(tbl.team)
ply:SetModel(tbl.model)
end
[/lua]
My If statement for saving:
[lua]
if !file.IsDir("GamemodeTest") then file.CreateDir("GamemodeTest") end
if !file.IsDir("GamemodeTest") then file.CreateDir("GamemodeTest") end
local tbl = {}
tbl["name"] = ply:Nick()
tbl["model"] = ply:GetModel()
tbl["team"] = ply:Team()
file.Write("GamemodeTest/"..ply:UniqueID()..".txt",util.TableToKeyValues(tbl))
ply:SendMessage("Saved Shit!",3,Color(255,255,255,255))
end
end
[/lua]
Sorry, you need to Log In to post a reply to this thread.