I found one online and had to heavily modify it to suit my needs. Had to ask the guy who created it first though, but he was ok about it.
Can't remember where exactly, but I think I still have the code I used somewhere..
http://www.myspace.com/madgamers