22.02.2015, 07:43
use cache_get_data(rows, fields);
example
example
pawn Код:
mysql_tquery(mysql, "SELECT `Hour`, `Min`, `Sec`, `Username` FROM `players` ORDER BY `Hour`, `Min`, `Sec` DESC LIMIT 10", "OnTopOnline", "d", playerid);
forward OnTopOnline(playerid);
public OnTopOnline(playerid)
{
new full_info[600];
cache_get_data(rows, fields);
if(!rows) return SendClientMessage(playerid, -1, "No row found");
for(new i, j = rows; i < j ; i++)
{
new username[MAX_PLAYER_NAME + 1], hour, sec, min2, sub_info[500];
cache_get_field_content(i, "Username", username);
hour = cache_get_field_content_int(i, "Hour"l);
min2 = cache_get_field_content_int(i, "Min");
sec = cache_get_field_content_int(i, "Sec");
format(sub_info, sizeof sub_info, "%d. Username: %s, Time: (%d|%d|%d)\n", i, username, hour, min2, sec);
strcat(full_info, sub_info);
}
ShowPlayerDialog(playerid, DIALOG_TOPSTATS, DIALOG_STYLE_MSGBOX, "Top Online", full_info, "Close", "");
return 1;
}