SA-MP Forums Archive
Compile error - 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: Compile error (/showthread.php?tid=618597)



Compile error - DarkElement - 07.10.2016

I wanted to create the command [/x], and now I have errors.

This is the screenshot with the errors:http://imgur.com/a/mSR9B

This is the code:
Код:
CMD:x(playerid, params[])
{
	new id, message[128], szMessage[256],sendername[25]];
	if(sscanf(params, "s[128]", message)) return SCM(playerid, COLOR_GREY, "/x [text]");
	{
		if(PlayerInfo[playerid][pAdmin] >= 1)
		{
			id = PlayerInfo[playerid][pReportAccepted];
			if(id >= 0)
			{
				format(szMessage, 256, "(/x) Admin %s: %s", GetName(playerid), message);
				SCM(id, COLOR_RED2, sMessage);
				SCM(playerid, COLOR_RED2, sMessage);
			}
		}
		else
		{
			new id2 = PlayerInfo[playerid][pReportAccepted2];
			if(id2 >= 0)
			{
				format(szMessage, 256, "(/x) Player %s: %s", GetName(playerid), message);
				SCM(id2, COLOR_RED2, sMessage);
				SCM(playerid, COLOR_RED2, sMessage);
			}
		}
	}
	return 1;
}
Can you help me please?


Re: Compile error - AndySedeyn - 07.10.2016

You have an extra square bracket ']' after 'sendername[25]'.


Re: Compile error - DarkElement - 07.10.2016

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
You have an extra square bracket ']' after 'sendername[25]'.
I deleted the extra square bracket and I still get the errors:

error 017: undefined symbol "sendername"
error 017: undefined symbol "sMessage"
error 017: undefined symbol "sMessage"
error 017: undefined symbol "sMessage"
error 017: undefined symbol "sMessage"


Re: Compile error - AndySedeyn - 07.10.2016

The errors are pretty trivial: you are using a variable which you haven't declared and you are declaring variables which aren't used.

You have multiple calls to sMessage but it's not declared. Plus, you declared sendername but aren't using it.

The sendername error isn't from the command. Can you show me the error line for that?