20.12.2015, 10:42
This command just show 1 result, i want 5 results
How i can do it?
How i can do it?
pawn Код:
CMD:searchban(playerid, params[])
{
new bName[24];
if(pData[playerid][P_Admin] < 2) return
SendClientMessage(playerid, COLOR_RED, LV_Fail);
if(sscanf(params,"s[24]", bName)) return
SendClientMessage(playerid, COLOR_RED, "Use: /searchban <Name/IP>");
new cQuery[1024], savingstring[256];
format(cQuery, sizeof(cQuery), "SELECT * FROM bans WHERE Name LIKE '%%%s%%' or IP LIKE '%%%s%%' ORDER BY Ban_ID DESC LIMIT 5", params, params);
mysql_query(MySQL, cQuery);
mysql_store_result();
new
BannedBy[24],
BannedName[24],
BannedIP[24],
BannedReason[24],
BannedDay,
BannedMonth,
BannedYear,
BannedHour,
BannedMinute
;
if(mysql_num_rows() > 0) {
mysql_fetch_field_row(BannedBy, "Admin");
mysql_fetch_field_row(BannedReason, "Reason");
mysql_fetch_field_row(savingstring, "Day"); BannedDay = strval(savingstring);
mysql_fetch_field_row(savingstring, "Month"); BannedMonth = strval(savingstring);
mysql_fetch_field_row(savingstring, "Year"); BannedYear = strval(savingstring);
mysql_fetch_field_row(savingstring, "Hour"); BannedHour = strval(savingstring);
mysql_fetch_field_row(savingstring, "Minute"); BannedMinute = strval(savingstring);
mysql_fetch_field_row(BannedName, "Name");
mysql_fetch_field_row(BannedIP, "IP");
format(cQuery, sizeof(cQuery),"%s banned %s(%s) for %s [%02d/%02d/%02d - %02d:%02d]\n",
BannedBy,
BannedName,
BannedIP,
BannedReason,
BannedDay,
BannedMonth,
BannedYear,
BannedHour,
BannedMinute
);
SendClientMessage(playerid, COLOR_YELLOW, cQuery);
} else {
SendClientMessage(playerid, COLOR_RED, "No bans found.");
}
return 1;
}