If you've done wrong, admit it. Don't lie about it.
If you get a ticket, accept it as deserving punishment for putting other lives at risk.
I think though, depending on various factors, that playing 'nice' can definitely get you further than stonewalling the cop. It all depends what you (potentially) did, who you are (being a white, upper middle class male doesn't hurt), and what you think the worse-case scenario will be.
Stonewalling isn't necessarily the best strategy, particularly if you both know you were in violation.
If I wasn't white, I think its highly possible things would have turned out differently.
Every encounter I've had with police so far (a few traffic stops, being caught dumpster diving, being in a few parks in Boston after midnight), I've found it just to be better to be nice. I've walked away from every situation so far with zero tickets, arrests, handcuffings, etc...