on 1:CTCPREPLY:PING*:/write pings.txt $1-

or somthing like that --[untested]--
just put a ping command below the original write, in the other script