


function PrecacheEntity( classname )

	local ent = ents.Create( classname )
	if ( ent && ent != NULL ) then
		ent:Remove()
	end

end


local function SENTPrecache( )

	// Uck.
	// For some reason when we give the player a ton of weapons on spawn
	// sometimes they will time out (overflow?) - this prevents that.
	PrecacheEntity( "weapon_physgun" )
	PrecacheEntity( "weapon_pistol" )
	PrecacheEntity( "weapon_shotgun" )
	PrecacheEntity( "weapon_crowbar" )

	// Precache our SWEPs
	local WeaponList = weapons.GetList()
	for k, v in pairs( WeaponList ) do
	
		PrecacheEntity( v.Classname )	
		
	end
	WeaponList = nil
	
	
	// Precache our SENTs
	local SentList = scripted_ents.GetList()
	for k, v in pairs( SentList ) do
	
		PrecacheEntity( v.t.Classname )	
	
	end
	SentList = nil

end



hook.Add( "InitPostEntity", "SENTPrecache", SENTPrecache )