At all times you MUST pass "the Attitude Test"
Police have the power over you and they expect you to act like you understand that. As soon as one starts berating them or not complying they will turn on you. It doesnt matter what country you are in- that parts
just basic human nature.
As others have said, contact the consulate of your country as ask them for help. They will be the ones who will understand the local laws and they will be able to explain how the system works.
But just dont expect that the laws of your own country will protect you in theirs. They may not have a "right to remain silent" or an "innocent untill proven guilty" process that you expect. Of course most modern countries have similar policies, but certainly not all third world countries will be gentle in thier approach.
Bribes may work in some third world countries, but its doubtful any first world police officer will accept a bribe. Its likely you would just end up in more trouble.
Good Luck and stay out of trouble lol