I made something like this a while ago for my RPG. I never backed it up though, and I lost it since.
Basically, the server communicated to the client through a series of clientCmds to dynamically build a dialog box, with whatever title, text, and whatever and however many buttons you wanted, each with whatever option and whatever serverCmd to call on click