Using InitPostEntity to delete all weapon entities on a map.

I’m trying to make it so i can use HL2DM maps on my gamemode, but we don’t want the players to be able to pickup the weapon drops around the map.
I asked someone and he pointed me to InitPostEntity but to be frank, i’m quite shit at GLua and i have no idea how to use this hook to actually delete entities.

Could someone give me some more information on how to use this?

[lua]

if SERVER then

hook.Add("InitPostEntity","deleteMapItems",function()
	timer.Simple(.1, function()
		for EID, _Entity in pairs(ents.GetAll()) do
			local del = ((string.sub(_Entity:GetClass(),0,4) == "item") or (string.sub(_Entity:GetClass(),0,6) == "weapon"))
			
			if(del)then
				if(_Entity:IsValid())then
					_Entity:Remove();
				end
			end
		end
	end)
end)

end
[/lua]

Tell me if it dosent work/do what you want.

That works fine, Thanks.
Now i actually know how to use it too.