put the kill matrix in the player stats data
authorRudolf Polzer <divVerent@xonotic.org>
Tue, 16 Aug 2011 12:46:41 +0000 (14:46 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Tue, 16 Aug 2011 12:46:52 +0000 (14:46 +0200)
currently only counts real kills, no teamkills or the like

qcsrc/server/cl_client.qc
qcsrc/server/g_damage.qc
qcsrc/server/playerstats.qc

index c3adfe7..0cf0d9e 100644 (file)
@@ -1637,6 +1637,8 @@ void ClientConnect (void)
 
        self.playerid = (playerid_last = playerid_last + 1);
 
+       PlayerStats_AddEvent(sprintf("kills-%d", self.playerid));
+
     if(clienttype(self) == CLIENTTYPE_BOT)
         PlayerStats_AddPlayer(self);
 
index 5975adf..d6020bd 100644 (file)
@@ -124,6 +124,8 @@ void GiveFrags (entity attacker, entity targ, float f, float deathtype)
        {
                // regular frag
                PlayerScore_Add(attacker, SP_KILLS, 1);
+               if(targ.playerid)
+                       PlayerStats_Event(attacker, sprintf("kills-%d", targ.playerid), 1);
        }
 
        PlayerScore_Add(targ, SP_DEATHS, 1);
index 402930f..c691d54 100644 (file)
@@ -232,6 +232,9 @@ void PlayerStats_Shutdown()
         for(p = playerstats_last; (pn = db_get(playerstats_db, sprintf("%s:*", p))) != ""; p = pn)
         {
             bufstr_set(b, i++, sprintf("P %s", p));
+            nn = db_get(playerstats_db, sprintf("%s:_playerid", p));
+            if(nn != "")
+                bufstr_set(b, i++, sprintf("i %s", nn));
             nn = db_get(playerstats_db, sprintf("%s:_netname", p));
             if(nn != "")
                 bufstr_set(b, i++, sprintf("n %s", nn));
@@ -285,6 +288,8 @@ void PlayerStats_AddGlobalInfo(entity p)
 
        if(p.alivetime)
                PlayerStats_Event(p, PLAYERSTATS_ALIVETIME, time - p.alivetime);
+
+       db_put(playerstats_db, sprintf("%s:_netname", p.playerstats_id), ftos(p.playerid));
        
        if(p.cvar_cl_allow_uid2name == 1 || clienttype(p) == CLIENTTYPE_BOT)
                db_put(playerstats_db, sprintf("%s:_netname", p.playerstats_id), p.netname);