Counting posts in custom post type by author

i found this code wordpress.org . This code would work in author template.

<?php
global $wp_query;
$curauth = $wp_query->get_queried_object();
$post_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author="" . $curauth->ID . "" AND post_type="post" AND post_status="publish"");
?>
<h2>Post Count: <?php echo $post_count; ?></h2>

But if you wish to use it somewhere else then replace $curauth->ID with author id and post with the post type you want

it should work .
All the best