somebody has already done this, though I can't remember who. I think it came up in the beta testing forum. there was a system whereby you could buy something from a dude using the action menu.
if you search the beta forum you might be able to find he - I seem to remember he posted a sample mission. remember to get his permission before you use any of his scripts!
Lecit's answer seems to make sense, give it a try. You just need to keep track of the variable playerwealth, or whatever you call it.
good luck