Code:
structs.h
after: int spells_to_learn; 
   int rip_cnt;
   int kill_cnt;
   int dt_cnt;
__
utils.h
#define GET_RIP_CNT(ch)         ((ch)->player_specials->saved.rip_cnt)
#define GET_KILL_CNT(ch)        ((ch)->player_specials->saved.kill_cnt)
#define GET_DT_CNT(ch)          ((ch)->player_specials->saved.dt_cnt)
__
players.c
load_char
    GET_RIP_CNT(ch) = 0;
    GET_KILL_CNT(ch) = 0;
    GET_DT_CNT(ch) = 0;
      case 'K':
        if (!strcmp(tag, "KilC"))      GET_KILL_CNT(ch)         = atoi(line);
        break;
in case D
        else if (!strcmp(tag, "DtC "))   GET_DT_CNT(ch)          = atoi(line);
in case R
        else if(!strcmp(tag, "RipC"))   GET_RIP_CNT(ch)  = atoi(line);
save_char:
  if (GET_RIP_CNT(ch)      != 0)                fprintf(fl, "RipC: %d\n", GET_RIP_CNT(ch));
  if (GET_KILL_CNT(ch)     != 0)                fprintf(fl, "KilC: %d\n", GET_KILL_CNT(ch));
  if (GET_DT_CNT(ch)       != 0)                fprintf(fl, "DtC : %d\n", GET_DT_CNT(ch));
__
Add the following right before the character is extracted when walking
into a deathtrap.
act.movement.c
GET_DT_CNT(ch) += 1;
__
fight.c
void die(struct char_data * ch, struct char_data * killer)
{
  gain_exp(ch, -(GET_EXP(ch) / 2));
  if (!IS_NPC(ch)) {
    GET_RIP_CNT(ch) = GET_RIP_CNT(ch) + 1;
    REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_KILLER);
    REMOVE_BIT_AR(PLR_FLAGS(ch), PLR_THIEF);
  }
  raw_kill(ch, killer);
  if (!IS_NPC(killer))
    GET_KILL_CNT(killer) = GET_KILL_CNT(killer) + 1;
}
__
class.c
  GET_RIP_CNT(ch) = 0;
  GET_KILL_CNT(ch) = 0;
  GET_DT_CNT(ch) = 0;
__
do.score
send_to_char(ch, "You have died %d times, killed %d opponents and walked into a deathtrap %d times.\r\n", GET_RIP_CNT(ch), GET_KILL_CNT(ch), GET_DT_CNT(ch));
__