PHP Code:
public client_PreThink(id)
{
if(!is_user_alive(id)) return;
if(pev(id, pev_button) & IN_DUCK)
if(pev(id, pev_flags) & FL_DUCKING)
client_print(id, print_chat, "Duck");
else client_print(id, print_chat, "Standing");
}
You don't have to check if the player is connected. He can't think (execute client_PreThink) when he isn't in the game.