cache_num_row
#4

Had you been using r41 this should work:

Код:
CMD:reports(playerid, params[]) 
{ 
    if(pInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,-1,""COL_RED"Not Admin!"); 
    new str[128]; 
    mysql_format(mysql, str, sizeof(str), "SELECT * FROM `reportlog`"); 
    mysql_tquery(mysql, str, "ShowReports", "u", playerid); 
    return 1; 
}  

forward ShowReports(playerid);
public ShowReports(playerid)
{
	if(cache_get_row_count() > 0)
	{
		SendClientMessage(playerid, -1, "Reports:"); 
        for(new i = 0; i < count; i++) 
        { 
            new reporter[25], reported[25], reportid, reportedon[25], reportreason[25], showreps[450]; 
            reportid = cache_get_field_content_int(i, "ID"); 
            cache_get_field_content(i, "Username", reporter); 
            cache_get_field_content(i, "Targetname", reported); 
            cache_get_field_content(i, "Data", reportedon); 
            cache_get_field_content(i, "Report", reportreason); 
            format(showreps, sizeof(showreps), "[#%d] (%s) %s has reported %s! [Reason: %s]", reportid, reportedon, reporter, reported, reportreason); 
            SendClientMessage(playerid, RED, showreps); 
        } 
	}
	else return SendClientMessage(playerid, RED, "There are currently no reports!"); 
	return 1;
}
You may be able to adapt this to work with your version (btw i'd recommend learning to use LIMIT in your queries that could potentially yield thousands of rows to avoid a database hiccup).
Reply


Messages In This Thread
cache_num_row - by Zeus666 - 21.10.2018, 14:13
Re: cache_num_row - by Chyakka - 21.10.2018, 14:21
Re: cache_num_row - by Zeus666 - 21.10.2018, 14:26
Re: cache_num_row - by Chyakka - 21.10.2018, 14:29
Re: cache_num_row - by Zeus666 - 21.10.2018, 14:30
Re: cache_num_row - by ReD_HunTeR - 21.10.2018, 14:37
Re: cache_num_row - by Zeus666 - 21.10.2018, 15:11
Re: cache_num_row - by Zeus666 - 21.10.2018, 15:31
Re: cache_num_row - by ReD_HunTeR - 21.10.2018, 15:33
Re: cache_num_row - by Zeus666 - 21.10.2018, 15:39

Forum Jump:


Users browsing this thread: 1 Guest(s)