Just as long as you don't expect this to prevent ping timeouts, as it won't. Furthermore be aware that many channels do not allow anti-dile scripts to be used.
As for the code: use the on INPUT event to detect what you type, ping your server, wait for the ping reply and then echo it to yourself (no one in the channel cares, so don't send it to the channel...)