You can eliminate the repetition of the counter for each event like so:
on *:quit:counter
on *:join:#:counter
on *:part:#:counter
on *:topic:#:counter
on *:action:*:#:counter
alias -l counter {
hinc -m counts $+($nick,$event)$+ 1
}
it's recommended that you add the -m switch just in case people install the script without restarting their mIRC.