SendReportToQueue - I Got some errors - 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: SendReportToQueue - I Got some errors (
/showthread.php?tid=565255)
SendReportToQueue - I Got some errors -
imnotadmin - 26.02.2015
Hello Everyone,
Today while scripting my Roleplay gamemode I got some errors :
Lines-
Код:
stock SendReportToQueue(ReportFrom, 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), 140);
Reports[newid][ReportFrom] = ReportFrom;
Reports[newid][TimeToExpire] = 5;
Reports[newid][HasBeenUsed] = 1;
Reports[newid][BeingUsed] = 1;
Reports[newid][ReportExpireTimer] = SetTimerEx("ReportTimer", 60000, 0, "d", newid);
new string[140];
format(string, sizeof(string), "Report from [%i] %s (RID: %i): %s", ReportFrom, GetPlayerNameEx(ReportFrom), newid, (report));
ABroadCast(COLOR_REPORT,string,1);
}
else
{
ClearReports();
SendReportToQueue(ReportFrom, report);
}
}
Errors in particular lines :
Код:
LINE:
strmid(Reports[newid][Report], Report, 0, strlen(report), 140);
ERROR : error 035: argument type mismatch (argument 2)
LINE : format(string, sizeof(string), "Report from [%i] %s (RID: %i): %s", ReportFrom, GetPlayerNameEx(ReportFrom), newid, (report));
ABroadCast(COLOR_REPORT,string,1);
ERRORs : 1) error 012: invalid function call, not a valid address
2) error 001: expected token: ";", but found ")"
3) error 029: invalid expression, assumed zero
Please help me,
Thanks.
Re: SendReportToQueue - I Got some errors -
Misiur - 26.02.2015
As for your first error, symbol "Report" is already defined
pawn Код:
enum {
Foo,
Bar,
Report
}
Foobar(Report[])
{
printf("%d", _:Report); //Will return 2
}
Rename your function parameter from Report to something else.
2 is identical, GetPlayerNameEx uses "ReportFrom" which is already defined in your enum.