I think you should look at your the clothes you are wearing and always try to blend in. Avoid big crowds. Always have local currency in small notes in different places on your body. One need to be careful paying brides, because that can land you in trouble as well. Read the situation without looking tense.
Do your homework before every trip. Plan ahead before you leave. Look at the specific region of the country you are visiting. What is happening in the news? Hopefully the people you are visiting knows more and have good friends that will be able to assist you to get you to a border.
In South Africa you need to watch out for Metro Police (Traffic) They love bribes – especially those just outside international airports. I always try to avoid them. I record them with my phone and keep my dashboard camera running. They are not used to dash camera’s and usually do not notice it.