update the lag every time u change the connection id:
on *:active:*:if ($lactivecid != $cid) { command.. }