PHP Code:
public Toplist(id)
{
for(new i; i < gMaxClients; 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]
for(new i; i < 16; i++)
{
new up = i -1
format(szTemp,charsmax(szTemp),"SELECT * FROM `deathrun` ORDER BY `deathrun`.`points` DESC LIMIT %i , %i", up, i)
SQL_ThreadQuery(g_SqlTuple,"Toplist2",szTemp,Data,1)
}
return PLUGIN_CONTINUE
}
public Toplist2(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)
}
if(SQL_ReadResult(Query,0) || SQL_ReadResult(Query,0) == 0)
{
new count, count1, count2, count3, count4, count5
count = SQL_ReadResult(Query,0)
count1 = SQL_ReadResult(Query,1)
count2 = SQL_ReadResult(Query,2)
count3 = SQL_ReadResult(Query,3)
count4 = SQL_ReadResult(Query,4)
count5 = SQL_ReadResult(Query,5)
if(count == 0)
count = 1
print_color(0, 1, 0, "^x04-=[Pingstars]=- ^x01 %s - %s - %i - %i - %i - %i ", count, count1, count2, count3, count4, count5)
}
return PLUGIN_HANDLED
}
returns
-=[Pingstars]=- - - 951 - 39 - 125 - 1
-=[Pingstars]=- - - 0 - 0 - 0 - 0
mysql entries:
steamid name points lives frags
STEAM_0:0:16065469 Pingstars * Schwabba 951 39 125 1
BOT [P*D]Bruce_Lee (99) 0 0 0 0
can't get the varchars.. dunno why..
when i change
PHP Code:
if(SQL_ReadResult(Query,0) || SQL_ReadResult(Query,0) == 0)
to
PHP Code:
if(SQL_ReadResult(Query,0))
then i get no results