my /reportold cmd doesnt work
#1

ok so i have this cmd
pawn Код:
CMD:report(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
        return 1;
    }
    if(PlayerInfo[playerid][pRMuted] != 0)
    {
        ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /shoporder command","Close", "");
        return 1;
    }
    if(JustReported[playerid] > 0)
    {
        SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!");
        return 1;
    }

    if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /report [text]");

    JustReported[playerid] = 25;
    SendReportToQue(playerid, params);
    SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins.");
    return 1;
}
and then i have this /reportold cmd
pawn Код:
CMD:reportsold(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new string[128];
        SendClientMessageEx(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]);
                    SendClientMessageEx(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]);
                    SendClientMessageEx(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]);
                    SendClientMessageEx(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]);
                    SendClientMessageEx(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]);
                    SendClientMessageEx(playerid, COLOR_REPORT, string);
                }
            }
        }
        SendClientMessageEx(playerid, COLOR_GREEN, "___________________________________________________");
    }
    return 1;
}
basically a player /report and it doesnt show up on /reportold so we have 20 players on and dont know who reported for what please help me fix it
Reply
#2

Show us SendReportToQue(playerid, params); because we can't tell how you set stuff up.
Reply
#3

pawn Код:
stock SendReportToQue(reportfrom, report[], reportlevel, reportpriority)
{
    new bool:breakingloop = false, newid = INVALID_REPORT_ID, string[128];

    for(new i=0;i<MAX_REPORTS;i++)
    {
        if(!breakingloop)
        {
            if(Reports[i][HasBeenUsed] == 0)
            {
                breakingloop = true;
                newid = i;
            }
        }
    }
    if(newid != INVALID_REPORT_ID)
    {
        switch(reportpriority)
        {
            case 1:
            {
                foreach(new i: Player)
                {
                    if(PlayerInfo[i][pAdmin] >= 2 && PlayerInfo[i][pTogReports] == 0)
                    {
                        GameTextForPlayer(i, "~r~DM Alert", 1500, 1);
                    }
                }
            }
            case 2:
            {
                foreach(new i: Player)
                {
                    if(PlayerInfo[i][pAdmin] >= reportlevel && PlayerInfo[i][pTogReports] == 0)
                    {
                        GameTextForPlayer(i, "~p~Priority Report", 1500, 1);
                    }
                }
            }
            case 3..4:
            {
                foreach(new i: Player)
                {
                    if(PlayerInfo[i][pAdmin] >= reportlevel && PlayerInfo[i][pTogReports] == 0)
                    {
                        TextDrawSetString(PriorityReport[i], "~y~New Report");
                        TextDrawShowForPlayer(i, PriorityReport[i]);
                        SetTimerEx("HideReportText", 2000, 0, "d", i);
                    }
                }
            }
            case 5:
            {
                foreach(new i: Player)
                {
                    if(PlayerInfo[i][pAdmin] >= reportlevel && PlayerInfo[i][pTogReports] == 0)
                    {
                        //GameTextForPlayer(i, "~w~~n~n~n~Priority 5 Item Pending", 1500, 3);
                        TextDrawSetString(PriorityReport[i], "~w~Priority 5 Item Pending");
                        TextDrawShowForPlayer(i, PriorityReport[i]);
                        SetTimerEx("HideReportText", 2000, 0, "d", i);
                    }
                }
            }
        }
        foreach(new i: Player)
        {
            if(PlayerInfo[i][pAdmin] >= 2 && PlayerInfo[i][pTogReports] == 0 && !GetPVarType(i, "TogReports")) {
                format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: 0 minutes | Priority: %i", GetPlayerNameEx(reportfrom), reportfrom, newid, report, reportpriority);
                SendClientMessageEx(i, COLOR_REPORT, string);
            }
            else if((reportpriority == 1 || reportpriority == 2) && PlayerInfo[i][pTogReports] == 0 && GetPVarType(i, "TogReports")) {
                format(string, sizeof(string), "%s (ID: %i) | RID: %i | Report: %s | Pending: 0 minutes | Priority: %i", GetPlayerNameEx(reportfrom), reportfrom, newid, report, reportpriority);
                SendClientMessageEx(i, COLOR_REPORT, string);
            }
        }
        SetPVarInt(reportfrom, "HasReport", 1);
        if(reportlevel == 2)
        {
            strmid(Reports[newid][Report], report, 0, strlen(report), 128);
            Reports[newid][ReportFrom] = reportfrom;
            Reports[newid][TimeToExpire] = 0;
            Reports[newid][HasBeenUsed] = 1;
            Reports[newid][BeingUsed] = 1;
            Reports[newid][ReportPriority] = reportpriority;
            Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        }
        else
        {
            strmid(Reports[newid][Report], report, 0, strlen(report), 128);
            Reports[newid][ReportFrom] = reportfrom;
            Reports[newid][TimeToExpire] = 0;
            Reports[newid][HasBeenUsed] = 1;
            Reports[newid][BeingUsed] = 1;
            Reports[newid][ReportPriority] = reportpriority;
            Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        }
    }
    else
    {
        ClearReports();
        SendReportToQue(reportfrom, report, reportlevel, reportpriority);
    }
}
Reply
#4

OP, I'll help you in a minute, but for now: Jesus christ, your code is resource expensive as hell. Better sort array than loop it 5 times!

Also
pawn Код:
for(new i=0;i<MAX_REPORTS;i++)
{
    if(!breakingloop)
    {
        if(Reports[i][HasBeenUsed] == 0)
        {
            breakingloop = true;
            newid = i;
        }
    }
}

//This will be executed MAX_REPORT times


for(new i=0;i<MAX_REPORTS;i++)
{
    if(Reports[i][HasBeenUsed] == 0)
    {
        newid = i;
        break;
    }
}

//Executed enough times
@Edit 2:

pawn Код:
if(reportlevel == 2)
        {
            strmid(Reports[newid][Report], report, 0, strlen(report), 128);
            Reports[newid][ReportFrom] = reportfrom;
            Reports[newid][TimeToExpire] = 0;
            Reports[newid][HasBeenUsed] = 1;
            Reports[newid][BeingUsed] = 1;
            Reports[newid][ReportPriority] = reportpriority;
            Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        }
        else
        {
            strmid(Reports[newid][Report], report, 0, strlen(report), 128);
            Reports[newid][ReportFrom] = reportfrom;
            Reports[newid][TimeToExpire] = 0;
            Reports[newid][HasBeenUsed] = 1;
            Reports[newid][BeingUsed] = 1;
            Reports[newid][ReportPriority] = reportpriority;
            Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
        }
Why are you using conditional at all? It's exactly the same as:
pawn Код:
strmid(Reports[newid][Report], report, 0, strlen(report), 128);
Reports[newid][ReportFrom] = reportfrom;
Reports[newid][TimeToExpire] = 0;
Reports[newid][HasBeenUsed] = 1;
Reports[newid][BeingUsed] = 1;
Reports[newid][ReportPriority] = reportpriority;
Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
Reply
#5

aigh't man thanks for helping me in advance
Reply
#6

Ok, to help you I need to know: What exactly happens when you type "/reportsold"? Nothing? Single line "___ REPORTS ___" shows up, but without any content? FYI you probably have a typo in command name ("reportsold")
Reply
#7

yea nothing appaears can you type the entire stock out again please? not in edits?
Reply
#8

First Of All

Look at this line

CMD:reportsold

You use told not sold
use comand /ropertsold and see if it's working,hope it help you
Reply
#9

james what the fuck are you on about?
Reply
#10

Misur is green lines and no writing as if it cant read the report or something
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)