04.10.2015, 18:32
PHP код:
CMD:top10on(playerid, params[])
{
new query[100];
mysql_format(connection, query, sizeof(query), "SELECT * FROM TableName ORDER BY pHours LIMIT 10;");
mysql_tquery(connection, query, "top10onQ", "d", playerid);
return 1;
}
forward top10onQ(playerid);
public top10onQ(playerid)
{
for(new i=0; i<cache_get_row_count(); i++)
{
new
username[MAX_PLAYER_NAME + 1],
pphour,
ppmins,
sub_info[50]
;
GetPlayerName(playerid, username, sizeof(username));
cache_get_field_content(i, "user", username);
pphour = cache_get_field_content_int(i, "phours");
ppmins = cache_get_field_content_int(i, "pminutes");
format(sub_info, sizeof(sub_info), "%s"ccwhite"%d. %s with "ccgreen"%d "ccwhite"hours, "ccgreen"%d "ccwhite"minutes\n", row + 1, ID, username, pphour, ppmins);
strcat(full_info, sub_info);
}
ShowPlayerDialog(playerid, 1101, DIALOG_STYLE_MSGBOX, "Top 10 Online", full_info, "OK", "Cancel");
return 1;
}