in this case use just
on *:ctcpreply:*ping*: {
var %tik $ctime - $2
var % $+ $iif($nick == $me,n bot,n $nick)
var % $+ $iif(%tik <= 0,tik 0)
msg %p %n $+ 's ping: $duration(%tik,1) $replacex(%tik, 0, Good, 1, Average, 2, High, 3, Critical)
unset %p
}
i didnt check the entire code, thats why i didnt see the value for %p