08.09.2014, 21:26
You can't possibly know if a player is in range of any house before having gone through all of them. I will say it once more: never return inside a loop unless you explicitly want to break it.
When the loop is entered for the first time, the code checks if the player is at house 0. If the player isn't at house 0 then the code skips the first block and goes straight to the "You are not near a house" message. Because of the return there, the function ends there and other houses aren't even checked.
When the loop is entered for the first time, the code checks if the player is at house 0. If the player isn't at house 0 then the code skips the first block and goes straight to the "You are not near a house" message. Because of the return there, the function ends there and other houses aren't even checked.