From: Jan Behrens Date: Sat, 1 Jun 2013 17:22:32 +0000 (+0200) Subject: fix db-key bug in PlayerStats_TeamScore() X-Git-Tag: xonotic-v0.7.0~23^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0ce1c5f72f76c60f648797b2959cceceec6d56be;p=xonotic%2Fxonotic-data.pk3dir.git fix db-key bug in PlayerStats_TeamScore() --- diff --git a/qcsrc/server/playerstats.qc b/qcsrc/server/playerstats.qc index a64f8d75d..80fc30bff 100644 --- a/qcsrc/server/playerstats.qc +++ b/qcsrc/server/playerstats.qc @@ -159,14 +159,18 @@ float PlayerStats_Event(entity e, string event_id, float value) return val; } -void PlayerStats_TeamScore(float t, string event_id, float value) +float PlayerStats_TeamScore(float t, string event_id, float value) { + if(playerstats_db < 0) + return 0; + string key; float val; key = sprintf("team#%d:%s", t, event_id); val = stof(db_get(playerstats_db, key)); val += value; db_put(playerstats_db, key, ftos(val)); + return val; } /* diff --git a/qcsrc/server/playerstats.qh b/qcsrc/server/playerstats.qh index 445d6f31c..ab28b3a55 100644 --- a/qcsrc/server/playerstats.qh +++ b/qcsrc/server/playerstats.qh @@ -41,7 +41,7 @@ void PlayerStats_AddEvent(string event_id); float PlayerStats_Event(entity e, string event_id, float value); // add a team score -void PlayerStats_TeamScore(float t, string event_id, float value); +float PlayerStats_TeamScore(float t, string event_id, float value); // call at game over void PlayerStats_Shutdown(); // send stats to the server