13.09.2016, 19:55
Look to the MySQL table picture then to the script then look to the SAMP picture. Only last row in the phpmyadmin table works well, others are foked.


PHP Code:
CMD:xplog(playerid, params[])
{
if(!IsAdminLevel(playerid, 4)) return NoPermsMSG(playerid);
new query[200], dialogfinal[1000], string[128], amount, reason[30], givenid, givenbyid;
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `xplog` ORDER BY `ID` DESC LIMIT 10");
new Cache: result = mysql_query(mysql, query);
strcat(dialogfinal, "Player\tGiven By\tAmount\tReason\n");
cache_get_row_count();
new count = cache_get_row_count();
if(count == 0) return ErrorMSG(playerid, "The XP log is empty.");
for(new i = 0; i < count; i++)
{
cache_get_row(i, 3, reason);
givenid = cache_get_field_content_int(i, "GivenID");
givenbyid = cache_get_field_content_int(i, "GivenByID");
amount = cache_get_field_content_int(i, "Amount");
format(string, sizeof(string), "%s\t%s\t%d\t%s\n", GetNameFromMySQLID(givenid), GetNameFromMySQLID(givenbyid), amount, reason);
strcat(dialogfinal, string);
}
cache_delete(result);
ShowPlayerDialog(playerid, DIALOG_XPLOG, DIALOG_STYLE_TABLIST_HEADERS, ""COL_WHITE"XP Log", dialogfinal, "Close", "");
return 1;
}
