I've seen people do it by ctcp $me ping, but that will give you a false reading, in that it will be double your lag, and it uses more bandwidth because you are sending more than one message to the server. You can just send the server a number to pong to you, test with this.
Code:
on ^*:pong:{
  if ($2 isnum) {
    echo -s SERVER lag is $calc($ticks - $2) ms.
    halt
  }
}

then just type //ping $ticks
that will work out the lag in miliseconds.