Bielie, I don't know where you get the idea for the quit event with a # prefix to it. There's no $chan in the quit event. You either need to put the #chan by itself or loop through the $comchan:
on !*:part:#:{
inc $+(%,p,#,$nick)
inc $+(%,p,$nick)
msg # $($+(%,p,$nick),2) has parted # $+ . $&
$nick has parted $iif($($+(%,p,#,$nick),2) = 1,$v1 time.,$v1 times.)
}
on !*:quit:{
var %q $comchan($nick,0)
while (%q) {
if $me ison $comchan($nick,%q) {
inc $+(%,q,$v2,$nick)
inc $+(%,q,$nick)
msg $v2 $($+(%,q,$v2,$nick),2) has parted $v2 $+ . $&
$nick has quit $iif($($+(%,q,$v2,$nick),2) = 1,$v1 time.,$v1 times.)
}
dec %q
}
}