got an error it displays on all names 48 Kills and dont shows the best 15
How to fix?
PHP Code:
public ShowTop10(id) {
new szTemp[512]
static Data[2]
Data[0] = id
format(szTemp,charsmax(szTemp),"SELECT * FROM stats ORDER BY points ASC LIMIT 10")
SQL_ThreadQuery(g_SqlTuple,"displaytop10",szTemp,Data,2)
}
public displaytop10(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
{
log_amx("Load - Could not connect to SQL database. [%d] %s", Errcode, Error)
}
else if(FailState == TQUERY_QUERY_FAILED)
{
log_amx("Load Query failed. [%d] %s", Errcode, Error)
}
new id
id = Data[0]
if(!SQL_MoreResults(Query)) {
return 1
}
static Name[33], Place, Points[33]
Place = 0
new MenuBody[512], len, keys;
len = format(MenuBody, 511, "\yStats TOP 10 \r[Version: \y%s\r]^n", VERSION);
while(SQL_MoreResults(Query)) {
Place++
SQL_ReadResult(Query,7,Name,32)
SQL_ReadResult(Query,1,Points,32)
len += format(MenuBody[len], 511-len, "^n\r%d. %s %d Kills", Place, Name, Points);
SQL_NextRow(Query)
}
keys = ( 1<<4 | 1<<8 | 1<<9 );
if( get_user_flags(id) & ADMIN_USER )
keys |= ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<5 | 1<<6 );
show_menu(id, keys, MenuBody, -1, "StatsMenu");
return 0
}
__________________