Put this into a fresh remote file.
on *:kick:#:{
inc %kick.counter
}
NOTE: If you have the inc %kick.counter in any other scripts, then the increase will be incorrect, as it will increase once for each inc %kick.counter command encountered. If you're going to use the above, I recommend going through your other scripts and removing that particular line.