Someone removed a model pack from the workshop and now on my saved map there are the large red error models everywhere. is there any way to remove these? there is no way to interact with them.
Make a file called remove_stuff.lua in garrysmod\garrysmod\lua\autorun\server. Place this in your file:
concommand.Add(“RemoveNotValidModel”, function(ply, command, arguments)
for k, v in pairs(ents.GetAll()) do
local Model = v:GetModel()
if Model and !util.IsValidModel(Model) and IsValid(v) and string.sub(Model,1,1) != “*” and ((string.Right(Model,4) == “.vmt” and Material(string.gsub(Model,“materials/”,"")):GetName() == “___error”) or string.Right(Model,4) != “.vmt”) then
local Class = v:GetClass()
if Class then
local Rep = 70-string.len("Removed: Model = "…Model)
if Rep < 0 then Rep = 0 end
print("Removed: Model = “…Model…string.rep(” “, Rep)…” Class = "…Class)
else print("Removed: Model = "…Model) end
Make a backup of your save.
Then run gmod, open your save and type this in your console: RemoveNotValidModel
All your error models would be gone if everything went well.