You overlooked a couple of factors:
You don't want to count the client that runs the code by adding an exclamation mark in front of that part event.
In fact, I think it's best to use hash tables for the counting task:
on *:start:loadcounter
on *:connect:loadcounter
on *:exit:hsave -o counter counter.hsh
on *:disconnect:hsave -o counter counter.hsh
alias -l loadcounter {
if $isfile(counter.hsh) && !$hget(counter) {
hmake counter 100
hload counter counter.hsh
}
}
on !*:part:#:{
hinc -m counter $nick
msg # Everyone, $nick has partted the $ord($hget(counter,$nick)) time!
}