SA-MP Forums Archive
error 001: expected token: ")", but found "[" - 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: error 001: expected token: ")", but found "[" (/showthread.php?tid=577855)



error 001: expected token: ")", but found "[" - Scottylad - 14.06.2015

I get
Quote:

error 001: expected token: ")", but found "["

For;
Код:
if (!isnull(PlayerInfo[playerid][pAdminName])) return SendClientMessage(playerid, COLOR_LIGHTRED, "You have not got an administration name.");
Why?


Re: error 001: expected token: ")", but found "[" - Virtual1ty - 14.06.2015

There's nothing wrong with that line. Post the lines around it. (It is either the line above it or the one below it.)
Also, that happens when you forgot to close the angle brackets (notice there is a missing angle bracket at the end):
Код:
if (!isnull(PlayerInfo[playerid][pAdminName)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You have not got an administration name.");



Re: error 001: expected token: ")", but found "[" - Scottylad - 14.06.2015

Whole command:

Код:
CMD:aduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
			new string[128];
		    switch(AdminDuty[playerid])
			{
				case 0:
				{
					if (!isnull(PlayerInfo[playerid][pAdminName])) return SendClientMessage(playerid, COLOR_LIGHTRED, "You have not got an administration name.");
				    AdminDuty[playerid] = 1;
					SetPlayerHealth(playerid, 500000);
					SetPlayerArmour(playerid, 500000);
					format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s is now on administrative duty.", GetNameEx(playerid));
					SendClientMessageToAll(COLOR_LIGHTBLUE, "   A administrative team member is now on duty.");
					SetPlayerColor(playerid,COLOR_LIGHTBLUE);
					SendClientMessageToAll(COLOR_YELLOW, string);
					SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
				}
				case 1:
				{
				    AdminDuty[playerid] = 0;
					SetPlayerHealth(playerid, 100);
					SetPlayerArmour(playerid, 100);
					format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s is now off administrative duty.", GetNameEx(playerid));
					SetPlayerColor(playerid,-1);
					SendClientMessageToAll(COLOR_YELLOW, string);
					if (!isnull(PlayerInfo[playerid][pName1])) SetPlayerName(playerid, PlayerInfo[playerid][pName1]);
			}
		}
	}
	else
	{
		return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command.");
	}
	return 1;
}



Re: error 001: expected token: ")", but found "[" - Yashas - 14.06.2015

Show your isnull define and PlayerInfo declaration.


Re: error 001: expected token: ")", but found "[" - Virtual1ty - 14.06.2015

There's nothing wrong with that code you posted either, as far as I can see.