Well, if you look at your screenshot, you'll see that it says
, which means that the DCC chat is never opened, and, therefore, the ON OPEN event never gets triggered.
The problem isn't with the script, but rather the fact that the DCC chat session never connects.