20.03.2013, 15:10
ZCMD:
This is cache:
How would you code if you don't know english, you can't ask for each command from the forum users.
This is cache:
How would you code if you don't know english, you can't ask for each command from the forum users.
pawn Код:
CMD:ranks(playerid, params[])
{
new query[256];
format(query, sizeof(query), "SELECT * FROM `playerdata` ORDER BY `score` DESC LIMIT 5");
mysql_function_query(DBHANDLE, query, true, "DisplayRanks", "i", playerid);
return 1;
}
forward DisplayRanks(playerid);
public DisplayRanks(playerid)
{
new rows, fields, row = 0, str[128];
new kills, name[MAX_PLAYER_NAME];
cache_get_data(rows, fields, DBHANDLE);
if(rows)
{
while(row < rows)
{
cache_get_row(row, NameRowNumber, name, dbHandle, 128);
kills = cache_get_row_int(row, KillsRowNumber);
format(str, sizeof(str), "[Rank %d] %s, Kills: %d", row+1, name, kills);
SendClientMessage(playerid, -1, str);
}
}
else return SendClientMessage(playerid, -1, "No ranks to show up.");
return 1;
}