How to remove a handful of different point entities on map start?

Hello,

I would like to have an autorun script that removes different point entities (ie. env_fire, env_blood, etc) on map load/start.

Can anyone help me with the script?

Thank you.

[lua]
local kill = {“env_fire”,“env_blood”} //Add entity classes here
hook.Add(“InitPostEntity”,“RemoveSomePointEntities”,function()
for k,v in pairs(kill) do
local ents = ents.FindByClass(v)
for i = 1,#ents do
ents*:Remove()
end
end
end)
[/lua]

Thank you!

Can I also remove by property name?

By that, do you mean an object that has a name set for it, or, say, this object has this property set to true?

The object has a name set.

Thank you.

[lua]
local killents = {“env_fire”,“env_blood”} //Add entity classes here
local killnames = {“ent1”,“ent2”} //Fill in names here
hook.Add(“InitPostEntity”,“RemoveSomePointEntities”,function()
for k,v in pairs(killents) do
local enttable = ents.FindByClass(v)
for i = 1,#enttable do
enttable*:Remove()
end
end
for k,v in pairs(killnames) do
local enttable = ents.FindByName(v)
for i = 1,#enttable do
enttable*:Remove()
end
end
end)
[/lua]

Sorry for not tabbing it, I wrote from the browser.