SnuZZer, please take a look at the source codes of the already existing scripts.
Just copy/pasting from here isn't going to teach you much other than that you forgot things to
includecopy. Take a look at the existing scripts, read the information provided by them in the threads and study everything....
[Release] Xniff (ActiveX Packet Sniffer) - Examples inside
And read everything in the first post of that tread and click on the links given there, install the example scripts and study them.
After all that modify the installed scripts to what you need based on the instructions which MrT posted here.