PDA

View Full Version : error 001: expected token: ")", but found "["


Scottylad
14/06/2015, 04:35 PM
I get 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?

Virtual1ty
14/06/2015, 04:45 PM
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.");

Scottylad
14/06/2015, 04:46 PM
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;
}

Yashas
14/06/2015, 04:46 PM
Show your isnull define and PlayerInfo declaration.

Virtual1ty
14/06/2015, 04:49 PM
There's nothing wrong with that code you posted either, as far as I can see.