Tata 0487 is absolutly right !
If you say "hola", when you find someone you know in a street, generally it means that you're at least willing to make a little stop and chat a little, you know, "a long time without seeing you", ect. But when you don't have that time to spend, you smile and say "adios", but you NEVER stop...you must keep going on. If you stop and you say "adios" you look crazy...Imagine if you stood in front of a friend and say "Gooby"...weird!
The only languaje I know in which you use the same word for "hello" and "goobye" is Italian, with the "ciao" word....