From 8e58484fc5c518d85de87226dced3276f9024d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Wed, 12 Jan 2005 01:24:40 +0000 Subject: [PATCH] get_stats now looks like this: native get_stats(index,stats[8],bodyhits[8],name[],len,authid[],authidlen=0); (authid + authidlen are new) + fixes --- dlls/csx_sql/CRank_sql.cpp | 16 ++++++++++------ dlls/csx_sql/msvc/csx.suo | Bin 13312 -> 0 bytes dlls/csx_sql/rank.cpp | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) delete mode 100755 dlls/csx_sql/msvc/csx.suo diff --git a/dlls/csx_sql/CRank_sql.cpp b/dlls/csx_sql/CRank_sql.cpp index b850fca8..f5957bba 100755 --- a/dlls/csx_sql/CRank_sql.cpp +++ b/dlls/csx_sql/CRank_sql.cpp @@ -94,7 +94,7 @@ void RankSystem::saveRankSql() // Query char query[2048]; - snprintf(query, 2047, "CREATE TABLE IF NOT EXISTS `%s` (`timestamp` int(11) NOT NULL default '0', `stats_authid` varchar(100) NOT NULL default '', `stats_name` varchar(100) NOT NULL default '', `stats_tks` int(11) NOT NULL default '0', `stats_damage` int(11) NOT NULL default '0', `stats_deaths` int(11) NOT NULL default '0', `stats_frags` int(11) NOT NULL default '0', `stats_shots` int(11) NOT NULL default '0', `stats_hits` int(11) NOT NULL default '0', `stats_hs` int(11) NOT NULL default '0', `stats_defusions` int(11) NOT NULL default '0', `stats_defused` int(11) NOT NULL default '0', `stats_plants` int(11) NOT NULL default '0', `stats_explosions` int(11) NOT NULL default '0', `stats_bodyhits0` int(11) NOT NULL default '0', `stats_bodyhits1` int(11) NOT NULL default '0', `stats_bodyhits2` int(11) NOT NULL default '0', `stats_bodyhits3` int(11) NOT NULL default '0', `stats_bodyhits4` int(11) NOT NULL default '0', `stats_bodyhits5` int(11) NOT NULL default '0', `stats_bodyhits6` int(11) NOT NULL default '0', `stats_bodyhits7` int(11) NOT NULL default '0', `stats_bodyhits8` int(11) NOT NULL default '0') TYPE=MyISAM", + snprintf(query, 2047, "CREATE TABLE IF NOT EXISTS `%s` (`timestamp` int(11) NOT NULL default '0', `stats_authid` varchar(100) NOT NULL default '', `stats_name` varchar(100) NOT NULL default '', `stats_tks` int(11) NOT NULL default '0', `stats_damage` int(11) NOT NULL default '0', `stats_deaths` int(11) NOT NULL default '0', `stats_frags` int(11) NOT NULL default '0', `stats_shots` int(11) NOT NULL default '0', `stats_hits` int(11) NOT NULL default '0', `stats_hs` int(11) NOT NULL default '0', `stats_defusions` int(11) NOT NULL default '0', `stats_defused` int(11) NOT NULL default '0', `stats_plants` int(11) NOT NULL default '0', `stats_explosions` int(11) NOT NULL default '0', `stats_bodyhits0` int(11) NOT NULL default '0', `stats_bodyhits1` int(11) NOT NULL default '0', `stats_bodyhits2` int(11) NOT NULL default '0', `stats_bodyhits3` int(11) NOT NULL default '0', `stats_bodyhits4` int(11) NOT NULL default '0', `stats_bodyhits5` int(11) NOT NULL default '0', `stats_bodyhits6` int(11) NOT NULL default '0', `stats_bodyhits7` int(11) NOT NULL default '0', `stats_bodyhits8` int(11) NOT NULL default '0', `stats_score` int(11) NOT NULL default '0') TYPE=MyISAM", csx_sqlstats_table->string); int queryResult = mysql_query(mysql, query); if (queryResult != MYSQL_QUERY_IS_A_OKAY) @@ -110,7 +110,7 @@ void RankSystem::saveRankSql() RankSystem::iterator a = front(); char *authid, *name; - int tks, damage, deaths, kills, shots, hits, hs, defusions, defused, plants, explosions, *bodyHits; + int tks, damage, deaths, kills, shots, hits, hs, defusions, defused, plants, explosions, *bodyHits, score; time_t now = time(NULL); while ( a ) @@ -137,8 +137,9 @@ void RankSystem::saveRankSql() plants = (*a).bPlants; explosions = (*a).bExplosions; bodyHits = ((*a).bodyHits); + score = (*a).score; - _snprintf(query, 2047, "UPDATE `%s` SET `timestamp` = %d, `stats_name` = \"%s\", `stats_tks` = \"%d\", `stats_damage` = \"%d\", `stats_deaths` = \"%d\", `stats_frags` = \"%d\", `stats_shots` = \"%d\", `stats_hits` = \"%d\", `stats_hs` = \"%d\", `stats_defusions` = \"%d\", `stats_defused` = \"%d\", `stats_plants` = \"%d\", `stats_explosions` = \"%d\", `stats_bodyhits0` = \"%d\", `stats_bodyhits1` = \"%d\", `stats_bodyhits2` = \"%d\", `stats_bodyhits3` = \"%d\", `stats_bodyhits4` = \"%d\", `stats_bodyhits5` = \"%d\", `stats_bodyhits6` = \"%d\", `stats_bodyhits7` = \"%d\", `stats_bodyhits8` = \"%d\" WHERE `stats_authid` = \"%s\" LIMIT 1", + _snprintf(query, 2047, "UPDATE `%s` SET `timestamp` = %d, `stats_name` = \"%s\", `stats_tks` = \"%d\", `stats_damage` = \"%d\", `stats_deaths` = \"%d\", `stats_frags` = \"%d\", `stats_shots` = \"%d\", `stats_hits` = \"%d\", `stats_hs` = \"%d\", `stats_defusions` = \"%d\", `stats_defused` = \"%d\", `stats_plants` = \"%d\", `stats_explosions` = \"%d\", `stats_bodyhits0` = \"%d\", `stats_bodyhits1` = \"%d\", `stats_bodyhits2` = \"%d\", `stats_bodyhits3` = \"%d\", `stats_bodyhits4` = \"%d\", `stats_bodyhits5` = \"%d\", `stats_bodyhits6` = \"%d\", `stats_bodyhits7` = \"%d\", `stats_bodyhits8` = \"%d\", `stats_score` = \"%d\" WHERE `stats_authid` = \"%s\" LIMIT 1", csx_sqlstats_table->string, now, name, @@ -162,6 +163,7 @@ void RankSystem::saveRankSql() bodyHits[6], bodyHits[7], bodyHits[8], + score, authid); // @@ -176,7 +178,7 @@ void RankSystem::saveRankSql() if (mysql_affected_rows(mysql) == 0) { // New player, do insert - _snprintf(query, 2047, "INSERT INTO `%s` (`timestamp`, `stats_authid`, `stats_name`, `stats_tks`, `stats_damage`, `stats_deaths`, `stats_frags`, `stats_shots`, `stats_hits`, `stats_hs`, `stats_defusions`, `stats_defused`, `stats_plants`, `stats_explosions`, `stats_bodyhits0`, `stats_bodyhits1`, `stats_bodyhits2`, `stats_bodyhits3`, `stats_bodyhits4`, `stats_bodyhits5`, `stats_bodyhits6`, `stats_bodyhits7`, `stats_bodyhits8`) VALUES (\"%d\", \"%s\", \"%s\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\")", + _snprintf(query, 2047, "INSERT INTO `%s` (`timestamp`, `stats_authid`, `stats_name`, `stats_tks`, `stats_damage`, `stats_deaths`, `stats_frags`, `stats_shots`, `stats_hits`, `stats_hs`, `stats_defusions`, `stats_defused`, `stats_plants`, `stats_explosions`, `stats_bodyhits0`, `stats_bodyhits1`, `stats_bodyhits2`, `stats_bodyhits3`, `stats_bodyhits4`, `stats_bodyhits5`, `stats_bodyhits6`, `stats_bodyhits7`, `stats_bodyhits8`, `stats_score`) VALUES (\"%d\", \"%s\", \"%s\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\", \"%d\")", csx_sqlstats_table->string, now, @@ -205,7 +207,9 @@ void RankSystem::saveRankSql() bodyHits[5], bodyHits[6], bodyHits[7], - bodyHits[8] + bodyHits[8], + + score ); int queryResult = mysql_query(mysql, query); @@ -226,5 +230,5 @@ void RankSystem::saveRankSql() mysql_close(mysql); clock_t stopTime = clock(); - MF_PrintSrvConsole("...done! (exported %d records in %.2f seconds)\n", exportedRecords, (double)(stopTime - startTime) / (double)CLOCKS_PER_SEC, stopTime, startTime); + MF_PrintSrvConsole("...done! (exported %d records in %.2f seconds)\n", exportedRecords, (double)(stopTime - startTime) / (double)CLOCKS_PER_SEC); } diff --git a/dlls/csx_sql/msvc/csx.suo b/dlls/csx_sql/msvc/csx.suo deleted file mode 100755 index a394b92a24b266b54c9694ed160bccf9785e3957..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d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HVa z?2bz__*-h1l{L zheLN#mpprrt^>Ov8^Vs@*7ZTi<9VD7?es@2m+wH-7Zf|yt8;A?I#lB@_afL zbsr5EB_@sFt3E~MF-*#Cfu>PX3l(JOD)2+36x@;5Yu%C?3-5GI6Yi*w2%lmWvSwRPU zOD(^4e-{2;_%~vV+hAi5YlQ2bq3j^gfA5sSb?@=~0nquFQn)Va`=n24uL|YdHnzFi z`R{K-#Fbe&=<@UFndi@y?}VS1_m9i_NB?W>(x148<<8~foZt6yYUKV`r~i(ma9)+q v&KMk|UMKlk{)M`Ze~m5u|DAN68xDrG!`9b+1uF;3_HN;Q#B%=sg9HBs3|o)= diff --git a/dlls/csx_sql/rank.cpp b/dlls/csx_sql/rank.cpp index 61d6e735..9dde7a47 100755 --- a/dlls/csx_sql/rank.cpp +++ b/dlls/csx_sql/rank.cpp @@ -188,7 +188,7 @@ static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param * return 0; } -static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */ +static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 7 param */ { int index = params[1] + 1; @@ -208,6 +208,8 @@ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 param */ cpStats[7] = (*a).getPosition(); MF_SetAmxString(amx,params[4],(*a).getName(),params[5]); + if (params[7] > 0) + MF_SetAmxString(amx,params[6],(*a).getUnique(),params[7]); for(int i = 1; i < 8; ++i) cpBodyHits[i] = (*a).bodyHits[i]; return --a ? index : 0;