Why this code takes 2-3seconds to calculate what is the player's ranking...
PHP Code:
public BankTop(id)
{
for(new i; i < 33; i++)
{
if(is_user_connected(i))
Save_MySql(i)
}
new Data[1]
Data[0] = id
new szTemp[512]
format(szTemp,charsmax(szTemp),"SELECT COUNT(*) FROM `bank` WHERE `money` >= %d", iMoney[id])
SQL_ThreadQuery(g_SqlTuple,"Sql_Rank",szTemp,Data,1)
return PLUGIN_CONTINUE
}
public Sql_Rank(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 count = 0
count = SQL_ReadResult(Query,0)
if(count == 0)
count = 1
new id
id = Data[0]
client_printc(id, "\g[ BANK ]\n Your rank is %i with %i$ money in bank", count, iMoney[id]);
return PLUGIN_HANDLED
}
Is it possible to make it faster ? Because when I wrote /rankbank, I've to wait some seconds to get answer ;D