Code:
public Show_Rank(id) // register cmd to this function
{
for(new i; i < MaxPlayers; i++)
{
if(is_user_connected(i))
Save_MySql(i) // Save all stats to get the correct rank
}
new Data[1]
Data[0] = id
new szTemp[512]
format(szTemp,charsmax(szTemp),"SELECT COUNT(*) FROM `tutorial` WHERE `exp` >= %d", Exp[id])
// Select the count where the exp is matching or higher (Incase of equal exp)
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_print(id, print_chat, "You are at rank %i with %i exp", count, Exp[id]);
return PLUGIN_HANDLED
}
how do i get the total entries to make it show like this:
"You are at rank %i from %i with %i exp" being the second "%i" the total entries/players.
Thanks in advance!