I dunno, I think you can hook "cancelselect" or some other command... do a debug on client_command() forward and see if it triggers something when you press escape but I doubt it.
Still, all those stuff won't actually be efficient on knowing if a player is afk, a player can be afk by actually leaving the keyboard and the game can be active... so the verry best way is to check for lack of input.