Fixed get_stats in csx and get_stats2 in csx_sql
csx and csx_sql now have exact same functionality, apart from csx_sql can also export stats to sql database if activated with cvar...
This commit is contained in:
parent
f18adbf9d6
commit
188023b5ac
|
@ -188,7 +188,7 @@ static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 5 param */
|
static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 7 param */
|
||||||
{
|
{
|
||||||
|
|
||||||
int index = params[1] + 1;
|
int index = params[1] + 1;
|
||||||
|
@ -209,7 +209,7 @@ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 5 param */
|
||||||
|
|
||||||
MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
|
MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
|
||||||
if (params[6] > 0)
|
if (params[6] > 0)
|
||||||
MF_SetAmxString(amx, params[5], (*a).getUnique(), params[6]);
|
MF_SetAmxString(amx, params[6], (*a).getUnique(), params[7]);
|
||||||
for(int i = 1; i < 8; ++i)
|
for(int i = 1; i < 8; ++i)
|
||||||
cpBodyHits[i] = (*a).bodyHits[i];
|
cpBodyHits[i] = (*a).bodyHits[i];
|
||||||
return --a ? index : 0;
|
return --a ? index : 0;
|
||||||
|
|
|
@ -139,7 +139,7 @@ void RankSystem::saveRankSql()
|
||||||
bodyHits = ((*a).bodyHits);
|
bodyHits = ((*a).bodyHits);
|
||||||
score = (*a).score;
|
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\", `stats_score` = \"%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,
|
csx_sqlstats_table->string,
|
||||||
now,
|
now,
|
||||||
name,
|
name,
|
||||||
|
@ -178,7 +178,7 @@ void RankSystem::saveRankSql()
|
||||||
|
|
||||||
if (mysql_affected_rows(mysql) == 0) {
|
if (mysql_affected_rows(mysql) == 0) {
|
||||||
// New player, do insert
|
// 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`, `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\")",
|
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,
|
csx_sqlstats_table->string,
|
||||||
now,
|
now,
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 7 param */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 4 param */
|
||||||
{
|
{
|
||||||
|
|
||||||
int index = params[1] + 1;
|
int index = params[1] + 1;
|
||||||
|
@ -227,7 +227,8 @@ static cell AMX_NATIVE_CALL get_stats2(AMX *amx, cell *params) /* 3 param */
|
||||||
for(RankSystem::iterator a = g_rank.front(); a ;--a){
|
for(RankSystem::iterator a = g_rank.front(); a ;--a){
|
||||||
if ((*a).getPosition() == index) {
|
if ((*a).getPosition() == index) {
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
|
if (params[4] > 0)
|
||||||
|
MF_SetAmxString(amx, params[3], (*a).getUnique(), params[4]);
|
||||||
cpStats[0] = (*a).bDefusions;
|
cpStats[0] = (*a).bDefusions;
|
||||||
cpStats[1] = (*a).bDefused;
|
cpStats[1] = (*a).bDefused;
|
||||||
cpStats[2] = (*a).bPlants;
|
cpStats[2] = (*a).bPlants;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user