Updated get_stats and get_stats2 to also retrieve authid

This commit is contained in:
Johnny Bergström 2005-01-14 12:14:34 +00:00
parent 9959ef52b3
commit f18adbf9d6
2 changed files with 8 additions and 4 deletions

View File

@ -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) /* 3 param */ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 5 param */
{ {
int index = params[1] + 1; 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(); cpStats[7] = (*a).getPosition();
MF_SetAmxString(amx,params[4],(*a).getName(),params[5]); MF_SetAmxString(amx,params[4],(*a).getName(),params[5]);
if (params[6] > 0)
MF_SetAmxString(amx, params[5], (*a).getUnique(), params[6]);
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;
@ -217,7 +219,7 @@ static cell AMX_NATIVE_CALL get_stats(AMX *amx, cell *params) /* 3 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;
@ -225,6 +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;

View File

@ -45,7 +45,7 @@ native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder /* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect. * and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */ * Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[8],bodyhits[8],name[],len); native get_stats(index,stats[8],bodyhits[8],name[],len,authid[],authidlen = 0);
/* Returns number of all entries in stats. */ /* Returns number of all entries in stats. */
native get_statsnum(); native get_statsnum();
@ -58,4 +58,4 @@ native get_statsnum();
* 3 - bomb explosions * 3 - bomb explosions
*/ */
native get_user_stats2(index,stats[4]); native get_user_stats2(index,stats[4]);
native get_stats2(index,stats[4]); native get_stats2(index,stats[4],authid[],authidlen = 0);