]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 c3adfe781d80a403b2c21465c1fd8919ca589511..0cf0d9ea512224843f2de8f7625cfb64cef2c84e 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 5975adf8a8dbfa04c9f5ce0237fa5a7ee18f4c9a..d6020bd349a8b7bf6955b838d5f094da1b80d7db 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 402930f89bc1c4c939fbd60b30260a37b8c2712c..c691d542bb63f2cf4bf44ec2c61ce009faee12c2 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);