29.08.2013, 15:54
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;
}
Code:
error 032: array index out of bounds (variable "text")
pawn Code:
SendReportToQue(playerid, text[128]);
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);
}
}
}
}