I wanted to print all entity classes as opposed to going in the directory and looking over at the filenames. How can I achieve this?
for k,v in ipairs(ents.GetAll() ) do
print(v:GetClass())
end
I did that which just gets the weapon classes that are spawned in on the current map.
I couldn't find anything on the gmod wiki for what I'm looking to do, any help would be appreciated!
scripted_ents.GetList, this won't include engine entities
Thanks! That's what I was looking for
I tried something else and managed to make this work:
hook.Add("PlayerSay", "PrintEntities", function(ply, text, team)
if ply:IsUserGroup("developer") or ply:IsUserGroup("superadmin") or ply:IsUserGroup("owner") then
if (string.lower(text) == "!getents") then
local Entg = file.Find( "gamemodes/terrortown/entities/weapons/*.lua", "GAME" ) // All classes in gamemodes folder
local Entl = file.Find( "lua/weapons/*.lua", "GAME" ) // All classes in lua folder
table.sort(Entg)
table.sort(Entl)
file.Write("entsG.txt", table.ToString(Entg))
file.Write("entsL.txt", table.ToString(Entl))
file.Write("addons.txt", table.ToString(engine.GetAddons()) )
ply:PrintMessage(3,"List of entities printed to your DATA folder successfully.")
end
else return
end
end)
The only problem is it looks all compact. Any way I could make it look a little more neatly?
Sorry, you need to Log In to post a reply to this thread.