Removing weapons and items with LUA.

Is it possible to remove all HL2 weapons and items from a map with LUA? Like, SMGs and ammo crates. I know a lot of you are going to say “decomp it and do it yourself” but here it isn’t an option. Any help? Tips? Scripts that already exist?

ent_remove_all entnamehere

npc_strider, weapon_smg, etc.

Any way to remove all without making a list of everything you want to remove?

Such as, all things that start with weapon_ or item_ or anything like that?

Oh, sure it’s possible. Give me a sec…

[lua]
function RemoveThings()
for k, v in pairs ( ents.GetAll() ) do
if ( string.find( v:GetClass(), “weapon_” ) or ( string.find( v:GetClass(), “item_” ) then
v:Remove()
end
end
end

hook.Add( “InitPostEntity”, “RemoveStuff”, RemoveThings )
[/lua]

Untested though

Put this code in a new .lua file in lua/autorun/server.

Alright.

[editline]01:26PM[/editline]

Thanks.