Display not found page 404 on specific Post Type

I have a script that wil; display a good 404 page for certain pages. Now I do not yet know what custom post types are, as I am just starting, but I think you can edit the script to fit your needs.

add_action('template_redirect', 'my_template_redirect');
function my_template_redirect()
{
    global $wp_query, $post;

    if (is_author() || is_attachment() || is_day() || is_page())
    {
        $wp_query->set_404();
    }

    if (is_feed())
    {
        $author     = get_query_var('author_name');
        $attachment = get_query_var('attachment');
        $attachment = (empty($attachment)) ? get_query_var('attachment_id') : $attachment;
        $day        = get_query_var('day');
        $page   = get_query_var('page');

        if (!empty($author) || !empty($attachment) || !empty($day) || !empty($page))
        {
            $wp_query->set_404();
            $wp_query->is_feed = false;
        }
    }
}

Hope you can do something with this this code. I use this in my functions.php to block access to the different parts of the website. They are also blocked for feeds.