Hi pat ur proplem is very very simple , if u can understand this concept u will never go wrong from.
In the first figure since a man is standing on the flat defnitly the rop will be subjected to tension.
But ur doubt is which direction?
that depends on the free body diagram
soppose if u cut the rope at the middle then u have to represent the diagram like this
Now if u free the horizontal surface and draw FBD
Now from the above diagram it is evident that tension is from BtoA in thgis FBD
NOw watch this FBD below which is intresting
Now watch the tension in this FBD it is from A to B. u can also find that Cx and CY had reversed their direction.
so my dear pal it is clear that the direction of the tension in the rope depends upon the object for which u have drawn the FBD
i hope that it clear now. if u rstill unclear plz specify