Ok, as far as him taking a piss and the lottery tickets, Ricky obviously didn't think they was gonna shoot, he probably thought they was just gonna try jump them. When Tre was saying they should stick together Ricky was playing it down, he even said "they ain't gonna do nothing, they just showing out n shyt". so when they pulled up he probably thought if he ran he would be alright, especially since he was already so far from their car.
As far as the bullet and the range, you gotta remember, the shot through the chest was the second shot. the first shot hit Ricky on the leg. now it's possible the shooter was aiming at his head and the bullet fell because of the range, giving the shooter a chance to judge the distance, aim a little higher to make up for the range and catch Ricky with the second shot. We don't know if the shooter was aiming directly at Ricky or if he had adjusted his aim. It's not impossible. Bullets don't disappear after a certain distance, they fall. If the shooter was taking that into account it is possible that he could hit Ricky and the fact that he shot twice supports this.