/report command help
#1

pawn Code:
CMD:report(playerid, params[])
{
    new text[128], giveplayerid;
    if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
        return 1;
    }
    if(JustReported[playerid] > 0)
    {
        SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!");
        return 1;
    }

    if (sscanf(params, "rs", giveplayerid, text)) return SendClientMessage(playerid, COLOR_GRAD2, "Usage: /report [id] [reason]");
    JustReported[playerid]=25;
    SendReportToQue(playerid, text[128]);
    SendClientMessageEx(playerid, COLOR_YELLOW, "Your report was sent to Administrators.");
    return 1;
}
I get this error:
Code:
error 032: array index out of bounds (variable "text")
In this line:
pawn Code:
SendReportToQue(playerid, text[128]);
And this is the SendReportToQue:
pawn Code:
stock SendReportToQue(reportfrom, reportto, report[])
{
    new bool:breakingloop = false, newid = INVALID_REPORT_ID;

    for(new i=0;i<MAX_REPORTS;i++)
    {
        if(!breakingloop)
        {
            if(Reports[i][HasBeenUsed] == 0)
            {
                breakingloop = true;
                newid = i;
            }
        }
    }
    if(newid != INVALID_REPORT_ID)
    {
        strmid(Reports[newid][Report], report, 0, strlen(report), 128);
        Reports[newid][ReportFrom] = reportfrom;
        Reports[newid][ReportTo] = reportto;
        Reports[newid][HasBeenUsed] = 1;
        Reports[newid][BeingUsed] = 1;
        new string[128];
        format(string, sizeof(string), "%s [%i] reported %s (RID: %i): %s", GetPlayerNameEx(reportfrom), reportfrom, GetPlayerNameEx(reportto), reportto, newid, (report));
        ABroadCast(COLOR_REPORT,string,2);
    }
    else
    {
        ClearReports();
        SendReportToQue(reportfrom, reportto, report);
    }
    if(PlayerInfo[reportfrom][pDonateRank] == 4)
    {
        new string[128];
        format(string, sizeof(string), "~r~Priority Report: ~g~%d", newid);
        foreach(Player, i)
        {
            if(PlayerInfo[i][pAdmin] >= 2)
            {
                GameTextForPlayer(i, string, 1500, 1);
            }
        }
    }
}
Reply


Messages In This Thread
/report command help - by damian123 - 29.08.2013, 15:54
Re: /report command help - by Dragonsaurus - 29.08.2013, 16:02
Re: /report command help - by Konstantinos - 29.08.2013, 16:16
Re: /report command help - by damian123 - 29.08.2013, 16:25
Re: /report command help - by Konstantinos - 29.08.2013, 16:28
Re: /report command help - by Dragonsaurus - 29.08.2013, 16:29
Re: /report command help - by damian123 - 29.08.2013, 16:32
Re: /report command help - by damian123 - 29.08.2013, 16:42
Re: /report command help - by Konstantinos - 29.08.2013, 16:45
Re: /report command help - by damian123 - 29.08.2013, 16:54

Forum Jump:


Users browsing this thread: 1 Guest(s)