SA-MP Forums Archive
/reports help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /reports help (/showthread.php?tid=448424)



/reports help - TranquiliZed - 04.07.2013

Ok, I have just about worked out all the bugs in my report system except this last one. I dont get any errors but it just doesnt work... Will show extra code if needed.

pawn Code:
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;
}



Re: /reports help - Income - 04.07.2013

I'll start off with saying that 1 loop would be more than enough instead of having a loop that passes 5000 times...
PHP Code:
new string[128];
for(new 
999>= 0i--)
{
    if(
Reports[i][BeingUsed] == && Reports[i][ReportPriority] == 5)
    {
        if(
Reports[i][ReportLevel] == 2)
        {
            
format(stringsizeof(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(playeridCOLOR_REPORTstring);
        }
    }

Tell me what happens with that.


Re: /reports help - TranquiliZed - 04.07.2013

So just do that? Do i need at anything else?