]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/playerstats.qc
Merge remote branch 'origin/master' into fruitiex/animations
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / playerstats.qc
index ea6956f79cb856eaffbb97de8648243981359858..7f20b92454db5084718d1ca79df4a4cef219fb76 100644 (file)
@@ -226,11 +226,15 @@ void PlayerStats_Shutdown()
                bufstr_set(b, i++, sprintf("T %s.%06d", strftime(FALSE, "%s"), floor(random() * 1000000)));
                bufstr_set(b, i++, sprintf("G %s", GetGametype()));
                bufstr_set(b, i++, sprintf("M %s", GetMapname()));
+               bufstr_set(b, i++, sprintf("I %s", matchid));
                bufstr_set(b, i++, sprintf("S %s", cvar_string("hostname")));
                bufstr_set(b, i++, sprintf("C %d", cvar_purechanges_count));
         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));
@@ -280,10 +284,12 @@ void PlayerStats_AddGlobalInfo(entity p)
 
        // add global info!
        if(p.alivetime)
+       {
                PlayerStats_Event(p, PLAYERSTATS_ALIVETIME, time - p.alivetime);
+               p.alivetime = 0;
+       }
 
-       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);
@@ -291,7 +297,7 @@ void PlayerStats_AddGlobalInfo(entity p)
     if(teamplay)
                db_put(playerstats_db, sprintf("%s:_team", p.playerstats_id), ftos(p.team));
 
-       if(p.alivetime > 0)
+       if(stof(db_get(playerstats_db, sprintf("%d:%s", p.playerstats_id, PLAYERSTATS_ALIVETIME))) > 0)
                PlayerStats_Event(p, PLAYERSTATS_JOINS, 1);
 
        strunzone(p.playerstats_id);
@@ -322,7 +328,7 @@ void PlayerStats_EndMatch(float finished)
 {
        entity p, winner;
     winner = PlayerScore_Sort(score_dummyfield);
-       FOR_EACH_PLAYER(p)
+       FOR_EACH_PLAYER(p) // spectators intentionally not included
        {
                PlayerScore_PlayerStats(p);
                PlayerStats_Accuracy(p);