I am wondering how I can use the /testfor command in Minecraft 1.8+ to check whether a certain player (For example the nearest player to a command block) has a number of items.
For example, if a player pushes a button, this causes a command block to check if they have 10 iron ingots. If they do, the command block outputs a signal to another command block that takes 10 iron from them and gives them a diamond, making a simple shop.
IS this possible? If it is, could someone reply with the commands, as I am not very good with redstone. Thanks :)