post author if statement

The get_posts() function retrieves posts from the database. If I understand you correctly, that’s not what you want though, you simply mean to check the author of the post currently displayed.

You can simply use $post->post_author. If outside the Loop, you have to call upon the $post global first.

Hence

global $post; // only required outside the loop

if ( 20 === $post->post_author ) {
    // do stuff
}

will do what you want.