Removing all props and npcs at death not with kill command

Does anyone know a good script that will remove all props and npcs at player death?

I am not talking about death as in the kill command.

I mean overall death “example: killed by npcs, crushed, point hurt, etc…”

It would be something along the lines of:


hook.Add( "PlayerDeath", "removepoo", function(ply, weapon, killer)
	for k,v in pairs(ents.GetByClass("npc")) do
		v:Remove()
	end
end )

I’m not sure the class is npc, it might be something else, and I’m not 100% sure the syntax is correct, since I wrote it in FF not a real editor…

Change npc to npc_*

Same goes for removing props, except use “prop_physics” instead of “npc_*” in ents.GetByClass. I’m not sure if that’s such a good idea though, weird things will probably happen like props being removed that are part of the map. You might be able to filter them out somehow but I can’t think of a way to do that.