How to make a /reports command
#1

I have tried so many times to get this to work. I need to make a /reports command and I havnt got a clue on why it isnt working. Ill post the enum and Command I already have. So if you guys can help. That would be great!

pawn Код:
enum reportinfo
{
    HasBeenUsed,
    Report[128],
    ReportFrom,
    CheckingReport,
    TimeToExpire,
    BeingUsed,
    ReportExpireTimer,
    ReplyTimerr,
    ReportPriority,
    ReportLevel
};

new Reports[MAX_REPORTS][reportinfo];

//Commnd

CMD:reports(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, NOTADMIN);
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128];
        SendClientMessage(playerid, COLOR_GREEN, "____________________ REPORTS _____________________");
        for(new i = 999; i >= 0; i--)
        {
            if(Reports[i][BeingUsed] == 1 && Reports[i][ReportPriority] == 5)
            {
                if(Reports[i][ReportLevel] == 2 || PlayerInfo[playerid][pAdmin] >= 2)
                {
                    format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: %d minutes | Priority: %i", GetPlayerNameEx(Reports[i][ReportFrom]), Reports[i][ReportFrom], i, (Reports[i][Report]), Reports[i][TimeToExpire], Reports[i][ReportPriority]);
                    SendClientMessage(playerid, COLOR_REPORT, string);
                }
            }
        }
        for(new i = 999; i >= 0; i--)
        {
            if(Reports[i][BeingUsed] == 1 && Reports[i][ReportPriority] == 4)
            {
                if(Reports[i][ReportLevel] == 2 || PlayerInfo[playerid][pAdmin] >= 2)
                {
                    format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: %d minutes | Priority: %i", GetPlayerNameEx(Reports[i][ReportFrom]), Reports[i][ReportFrom], i, (Reports[i][Report]), Reports[i][TimeToExpire], Reports[i][ReportPriority]);
                    SendClientMessage(playerid, COLOR_REPORT, string);
                }
            }
        }
        for(new i = 999; i >= 0; i--)
        {
            if(Reports[i][BeingUsed] == 1 && Reports[i][ReportPriority] == 3)
            {
                if(Reports[i][ReportLevel] == 2 || PlayerInfo[playerid][pAdmin] >= 2)
                {
                    format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: %d minutes | Priority: %i", GetPlayerNameEx(Reports[i][ReportFrom]), Reports[i][ReportFrom], i, (Reports[i][Report]), Reports[i][TimeToExpire], Reports[i][ReportPriority]);
                    SendClientMessage(playerid, COLOR_REPORT, string);
                }
            }
        }
        for(new i = 999; i >= 0; i--)
        {
            if(Reports[i][BeingUsed] == 1 && Reports[i][ReportPriority] == 2)
            {
                if(Reports[i][ReportLevel] == 2 || PlayerInfo[playerid][pAdmin] >= 2)
                {
                    format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: %d minutes | Priority: %i", GetPlayerNameEx(Reports[i][ReportFrom]), Reports[i][ReportFrom], i, (Reports[i][Report]), Reports[i][TimeToExpire], Reports[i][ReportPriority]);
                    SendClientMessage(playerid, COLOR_REPORT, string);
                }
            }
        }
        for(new i = 999; i >= 0; i--)
        {
            if(Reports[i][BeingUsed] == 1 && Reports[i][ReportPriority] == 1)
            {
                if(Reports[i][ReportLevel] == 2 || PlayerInfo[playerid][pAdmin] >= 2)
                {
                    format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: %d minutes | Priority: %i", GetPlayerNameEx(Reports[i][ReportFrom]), Reports[i][ReportFrom], i, (Reports[i][Report]), Reports[i][TimeToExpire], Reports[i][ReportPriority]);
                    SendClientMessage(playerid, COLOR_REPORT, string);
                }
            }
        }
        SendClientMessage(playerid, COLOR_GREEN, "___________________________________________________");
    }
    return 1;
}
Rep to anyone who can fix this
Reply
#2

Your best way is to copy every report into a file and then load that file using dini or y_ini, after just load let's say that last 5-10 reports on that list when doing /reports what i see is that this might not even work...
Reply
#3

The /report command is used to list the non accepted reports. So I see this becoming very confusing
Reply
#4

no look when player does /report it says the text to a file called Reports then on the cmd /reports get what's inside of the Reports.txt just read a couple of tut's and y_ini tut's...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)