Report
#1

How to get the latest 5 reports?

PHP код:
CMD:report(playerid,params[])
{
    new 
id,reason[50],string[300];
    if(
sscanf(params,"us[178]",idreason)) return SendClientMessage(playerid, -1,"USAGE: /report [playerid] [reason]");
    
format(string,sizeof(string),"[Notice]: Player %s (Id: %d) reported By %s(Id: %d) For: %s"GetName(id), idGetName(playerid), playeridreason);
    
lastreport string;
    for(new 
0MAX_PLAYERSi++)
    {
        if(
pData[i][Admin] >= || IsPlayerAdmin(i))
        {
            
SendClientMessage(i0xFF0000FFstring);
        }
    }
    
format(string,sizeof(string),"Player %s (Id: %d) reported By %s(Id: %d) For:  %s"GetName(id), idGetName(playerid), playeridreason);
    
IRC_Say(groupID,"%"IRC_CHANNELstring);
    return 
1;
}
CMD:reports(playeridparams[])
{
    if(
pData[playerid][Admin] >= 3)
    {
    
SendClientMessage(playeridCOLOR_YELLOW"Last report was:");
    
SendClientMessage(playerid0xFF0000FFlastreport);
    } else return 
SendClientMessage(playerid,COLOR_YELLOW,"Only +level 3 can use this command");
    return 
1;

Reply
#2

Make an array out of lastreport. And start storing the reports for example: lastreport[1], lastreport[2] etc. So when you get a new report make lastreport[5] = lastreport[4], lastreport[4] = lastreport[3], lastreport[3] = lastreport[2], lastreport[2] = lastreport[1] and lastreport[1] = string. Also i am pretty sure that is not how you save strings into a variable. So lastreport would have to be a 2D array, so lastreport[number of reports][size of the string]. So format(lastreport[1], sizeof(lastreport[1]), string); would be an example how to save the string into the first report, but like i mentioned above you would want to start from the other end.
Reply
#3

Quote:
Originally Posted by Type-R
Посмотреть сообщение
Make an array out of lastreport. And start storing the reports for example: lastreport[1], lastreport[2] etc. So when you get a new report make lastreport[5] = lastreport[4], lastreport[4] = lastreport[3], lastreport[3] = lastreport[2], lastreport[2] = lastreport[1] and lastreport[1] = string. Also i am pretty sure that is not how you save strings into a variable. So lastreport would have to be a 2D array, so lastreport[number of reports][size of the string]. So format(lastreport[1], sizeof(lastreport[1]), string); would be an example how to save the string into the first report, but like i mentioned above you would want to start from the other end.
i do not understand so if i made this arrays when i do /report how to check that the lastreport[1] is done so it set the string on lastreport[2]?
Reply
#4

bumb
Reply
#5

Wait at least 24 hours before bumping please, also, if you get no help, you might start thinking about why you get no help
Reply
#6

Код:
new reportLog[5][128];

CMD:report(playerid, params[]) 
{
...
reportLog[4] = reportLog[3];
reportLog[3] = reportLog[2];
reportLog[2] = reportLog[1];
reportLog[1] = reportLog[0];
reportLog[0] = string;
...

CMD:reports(playerid, params[])
{
   #pragma unused params

   if (strlen(reportLog[0]))
   {
   	SendClientMessage(playerid, -1, "Last report(s):");
   	SendClientMessage(playerid, -1, reportLog[0]);
	SendClientMessage(playerid, -1, reportLog[1]);
...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)