Part is the same except using $nick and not $knick
on *:part:#:{
if $hget(textcounter. $+ #) { hdel $v1 $nick }
}
For quits, you have to loop through $comchan() because there is no specific channel associated with a quit.
on *:quit:{
var %i = 1
while $comchan($nick,%i) {
if $hget(textcounter. $+ $v1) { hdel $v1 $nick }
inc %i
}
}