(TMZ) -- Hannibal Buress seemed like he was trying to do the right thing before getting busted for disorderly intoxication ... 'cause he asked a cop to order him a ride home.

TMZ has obtained Hannibal's arrest affidavit from his Saturday night bust in Miami, in which the arresting officer describes what allegedly happened before he detained the comedian.

The officer says Hannibal approached him with blood shot eyes and a strong odor of alcohol coming from his breath, and then asked the cop to call him an Uber. The officer says he refused, which caused Hannibal to become angry and belligerent. 

**WARNING: Explicit language**

The cop goes on to say Hannibal then went inside a bar, which the cop says he asked Hannibal to leave since he was too drunk. The two then made it outside, where the officer says Hannibal continued to hurl profanities at him and caused a crowd to form.

The cop says he asked him to leave five times before cuffing him.

As TMZ reported ... Hannibal was released around 6 AM Sunday on a $500 bond. His mug shot was pretty epic, too. 

Photo: AOL