James Payton (Ice Cube) is a hard-as-nails cop, on an undercover operation where fake passports are being smuggled into Atlanta, an operation that James believes that would lead him to catch a man named "Omar". After a shootout with the smugglers, and a car chase that leads one injured, the lieutenant leading the case ask James to drop the case on "Omar", something James doesn't.
Ben Barber (Kevin Hart), a fast-talking, jumpy high school security guard, applies for the Atlanta City Police Academy, and when he gets in, decides to ask James for his blessings to marry his sister Angela (Tika Sumpter). James then says Ben has to be worthy of Angela, making him go on a "ride along" to prove it.
After picking up Ben and taking him to the police station, James tells dispatch to give him all the 126's that are called into the station. After James makes Ben take care of all the 126's, something he is unsuccessful of, James arrives at the park to question an informant Runflat (Jay Pharoah), about a connection of Serbia and "Omar". He finds out that a shipment will come in later today. After leaving the park, Ben saying that he requires confidence with a gun at his waist, he strikes a conversation with the gun store dealer. After finding out that Zastava M92's have been given to the store, Ben realises he got a clue for James. After another 126 was called in, Ben and James are called to a market where a drunk man called Crazy Cody (Gary Owen) is being disorderly. Ben tried to subdue him but is unable to, and James arrests him.
Ben asks to be taken home before he receives a call from Angela. He tells her about his stressful day, before Angela says that James plays poker with a guy named Crazy Cody, along with telling him that 126's are a code for annoying situations no one wants to deal with. He then goes into the police station and sees Cody laughing with James and his partners Santiago (John Leguizamo) and Miggs (Bryan Callen).
Upset at James, Ben refuses to go home and instead takes a call to respond to a disturbance at strip club. At the club, two men get into a mexican standoff with James and Ben, before Ben, thinking it's another joke call, fools around. James subdues the men, and the two are then tipped off about a gun deal involving Omar's men. Ben then confronts James about the 126's, before James receives a call from Santiago in the car. After finding out that Runflat had turned himself in, Ben says how Runflat's brother in the park said that Runflat had just got out of prison. James then contradicts, saying that Runflat hadn't been in prison for over two years, leading to another clue.
The men go to talk Runflat's other brother, J, who had just been released from prison. Trying to find out the location of the gun deal, Ben accidentally shoots J, and finds out that the deal would take place at an old abandoned warehouse at 9pm.
After arriving at the warehouse, James leaves Ben behind, and decides to infiltrate the warehouse with Santiago and Miggs. When he enters, James is betrayed by Santiago and Miggs, who turn out to be on Omar's payroll. James is then tied up, just when Ben sees. As the deal begins, Ben enters pretending to be Omar (since no one has ever actually seen the real Omar). Ben then wreaks havoc at the deal, and right as Ben is about to leave with James, the real Omar (Laurence Fishburne) appears. A shootout ensues, and many of Omar's men are killed. James and Ben take the money meant for the deal and escape, before Ben takes a loose grenade and blows up the warehouse. Unbeknownst to them, Santiago, Miggs and Omar all escape.
Santiago and Miggs arrive at Angela's apartment and tie her up. As she was playing one of Ben's video games, Ben's fellow players hear the confrontation ensuing between Angela, Miggs and Santiago from Ben's headset. At the hospital, Ben receives a call from the fellow player, and tells James that there's something going on at the apartment. James says he would leave alone, but Ben persists to come with him. After seeing some dirty cops arrive at the hospital, James takes Ben and leaves to go to the apartment, along with Omar's money. James then injures Miggs, before getting into a fight with Santiago. As Santiago is about to shoot James, Angela knocks him out from behind with a frying pan, before Omar takes the bag of money and Angela, and leaves the apartment.
James follows Omar and Angela outside after hearing her screams, and confronts them. Right as Omar is about to shoot James, Ben slides over a car and kicks him, and James shoots Omar twice, injuring, but not killing him. Police show up and Omar, Miggs and Santiago are arrested. After James approaches Omar, who tells him that James will always miss the "bigger picture". After he tells the ambulance to "get his ass outta here", Angela and Ben stand next to James, and James gives Ben his blessing.