From: Rudolf Polzer Date: Tue, 16 Aug 2011 12:46:41 +0000 (+0200) Subject: put the kill matrix in the player stats data X-Git-Tag: xonotic-v0.5.0~136 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d17eaa6d6ed46e500a49bf04e336e1a4379a9457;p=xonotic%2Fxonotic-data.pk3dir.git put the kill matrix in the player stats data currently only counts real kills, no teamkills or the like --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index c3adfe781..0cf0d9ea5 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 5975adf8a..d6020bd34 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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); diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index 402930f89..c691d542b 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -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);