mysql query
#4

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.
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;
}
Reply


Messages In This Thread
mysql query - by David94 - 19.03.2013, 14:17
Re: mysql query - by kamzaf - 19.03.2013, 19:34
Re: mysql query - by David94 - 20.03.2013, 15:01
Re: mysql query - by PaulDinam - 20.03.2013, 15:10
Re: mysql query - by Misiur - 20.03.2013, 15:16
Re: mysql query - by PaulDinam - 20.03.2013, 15:29
Re: mysql query - by Misiur - 20.03.2013, 15:30
Re: mysql query - by David94 - 29.03.2013, 15:59

Forum Jump:


Users browsing this thread: 1 Guest(s)