The reason the phrase has context In the first one Is as follows:
Main terrorist Hans:Mr. Mystery Guest are you still there?
John Mcclane:Yeah I'm still here
Hans:Who are you exactly?Someone who watched too many action movies as a child and thinks he's John Wayne,Rambo,Lewis Stevens?
Mcclane:Actually I was kind of partial to Roy Rogers myself.Always liked those sequin shirts.
Hans:Do you really think you can stop us Mr.Cowboy?
Well,Yippee ki-yay, motherfucker!