14.07.2013, 11:33
Something like this:
pawn Код:
CMD:lastentered(playerid,params[])
{
new faction = PlayerInfo[playerid][pFaction];
if(faction != LSPD) return SCM(playerid, COLOR_SALMON, "Invalid faction.");
format(query, sizeof(query), "SELECT name, timedate FROM biz_visits ORDER BY id DESC LIMIT 5");
mysql_function_query(dbHandle, query, true, "OnQueryFinished", "d", playerid);
}
forward OnQueryFinished(playerid);
public OnQueryFinished(playerid)
{
new rows, fields, name[MAX_PLAYER_NAME], date[16];
cache_get_data(rows, fields);
SCM(playerid, COLOR_SALMON, "_________Entered people:_________");
for(new p = 0; p < rows; p++)
{
cache_get_field_content(p, "name", name);
cache_get_field_content(p, "timedate", date);
format(string, sizeof(string), "%d. %s entered at %s.", p+1, name, date);
SCM(playerid, COLOR_WHITE, string);
}
return 1;
}