• Getting all the models from spawnlist.txt
    0 replies, posted
Hi guys, helping a friend out here and apparently I need help myself too! I'm trying to read the files in settings/spawnlist and get all of the models from the KeyValues, but all of my stupidness can only manage to return 1 model from the whole file, and there are 200+ models, could somebody maybe give me a hand? [LUA]local Trombone local Drumkit function PrintProps() local lists = file.Find("settings/spawnlist/*.txt", "GAME") local props = file.Read("settings/spawnlist/"..lists[1], "GAME") local prop = util.KeyValuesToTable(props) for k,v in pairs(prop) do if k == "contents" then Trombone = v end end for k, v in pairs(Trombone[1]) do if k == "model" then Drumkit = v end end print(Drumkit) end concommand.Add("lol2", PrintProps) [/LUA] That returns the 1st model in the 001-construction-props.txt folder, which is "models/Cranes/crane_frame.mdl" If there is an easier way to do what I'm trying to do, or if not a way to do what I'm trying to do.. CORRECTLY, might somebody be able to help? --EDIT-- Also, Garry if you're reading this. That thread of mine that you closed saying "This is modding help, not 'help I broke my gmod install help' " I didn't break my sandbox, the script I was making caused that error, Sandbox works fine thank-you. So I believe that my thread had perfect reason to go where it went.
Sorry, you need to Log In to post a reply to this thread.