Renoard's advice works if you actually expect the work to succeed, and if that's what you can get for an advance. I'd imagine most people in your friend's shoes would be amenable to the percentage of sales without the advance. (That's low-risk for him.)
If your friend is making another non-hit movie and you are not emotionally invested, I would recommend a ghost-writer approach. You get paid by the hour, and when you're done it matters not one iota whether the movie is a flop or a blockbuster.
For royalties, you stand to lose the most if the movie is a flop. (Low risk for your friend, he doesn't spend up front.)
For an hourly wage, you stand to lose the most if the movie is a blockbuster. (High risk for your friend, he spends money up front.)
For an advance, see "hourly wage" above.
Before reading Renoard's response, I actually though you were talking just about Ghostwriter rates.
My Writers' Market 2010 (sorry I don't have newer) has a section called "How Much Should I Charge?" I don't see a section for ghostwriting screenplays, but for ghostwriting a novel it recommends the following price points:
Ghostwriting "as told to", High $100/hr, Low, $50/hr; high, $51k for a whole project, low $5.5k for a whole project.
Ghostwriting for no credit, High $100/hr, Low $30/hr; high $45k for a whole project, low $1,500 for a whole project.