Move cmpPlayer definition inside if-statement.