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=581479)



error 001: expected token: ")", but found "]" - alexanderjb918 - 13.07.2015

line:

Код:
C:\Users\ii\Desktop\roleplay.pwn(26201) : warning 217: loose indentation
C:\Users\ii\Desktop\roleplay.pwn(26282) : error 001: expected token: ")", but found "["
C:\Users\ii\Desktop\roleplay.pwn(26282) : error 029: invalid expression, assumed zero
C:\Users\ii\Desktop\roleplay.pwn(26282) : warning 215: expression has no effect
C:\Users\ii\Desktop\roleplay.pwn(26282) : error 001: expected token: ";", but found "]"
C:\Users\ii\Desktop\roleplay.pwn(26282) : fatal error 107: too many error messages on one line
Код:
forward ViewPlayer(extraid, name[]);
public ViewPlayer(extraid, name[])
{
		new string[200];
        new HistoryString[2048];
        if (GetFactionType(extraid) != FACTION_POLICE)
            return 0;
        new sex[18];
        if(PlayerData[extraid][pMDCPlayer][pGender] == 1) { sex = "Male"; }
		if(PlayerData[extraid][pMDCPlayer][pGender] == 2) { sex = "Female"; }
        SendClientMessageEx(extraid, COLOR_GREEN, "------------------------_POLICE DATABASE_----------------------");
        SendClientMessageEx(extraid, COLOR_GREEN, "Logged in as %s", ReturnName(extraid, 1));
        SendClientMessageEx(extraid, COLOR_GREEN, "------------------------_POLICE DATABASE_-----------------------");
		SendClientMessageEx(extraid, COLOR_WHITE, "------------------------_PERSON CHECK_----------------------");
        SendClientMessageEx(extraid, COLOR_WHITE, "Name: %s", ReturnName(PlayerData[extraid][pMDCPlayer], 1));
        if(PlayerData[extraid][pGender] == 1) ? { sex = "Male"; } else { sex = "Female"; }
		{
				format(string, sizeof(string), "Gender : %s", sex);
				strcat(HistoryString, string, sizeof(HistoryString));
		}
        SendClientMessageEx(extraid, COLOR_WHITE, "Date Of Birth: %s", PlayerData[PlayerData[extraid][pMDCPlayer]][pBirthdate]);
        SendClientMessageEx(extraid, COLOR_WHITE, "Driving License: %s", PlayerData[PlayerData[extraid][pMDCPlayer]][pDrivingTest]);
        SendClientMessageEx(extraid, COLOR_WHITE, "Time in Los Santos: %d", PlayerData[PlayerData[extraid][pMDCPlayer]][pPlayingHours]);
        SendClientMessageEx(extraid, COLOR_WHITE, "Phone Number: %s", PlayerData[PlayerData[extraid][pMDCPlayer]][pPhone]);
        SendClientMessageEx(extraid, COLOR_WHITE, "---------------------------------------------------------------");
        return 1;
}
Код:
if(PlayerData[extraid][pMDCPlayer][pGender] == 1) { sex = "Male"; }



Re: error 001: expected token: ")", but found "]" - TonyVk - 13.07.2015

why 2 closed brackets here [pMDCPlayer]]:

Код:
if(PlayerData[extraid][pMDCPlayer][pGender] == 1) { sex = "Male"; }
if(PlayerData[extraid][pMDCPlayer][pGender] == 2) { sex = "Female"; }



Re: error 001: expected token: ")", but found "]" - MrViolence101 - 13.07.2015

you said :

Код:
if(PlayerData[extraid][pMDCPlayer]][pGender] == 1) { sex = "Male"; }
you made a simple mistake by putting double brackets somewhere in the line.
Its suppose to look like this :

Код:
if(PlayerData[extraid][pMDCPlayer][pGender] == 1) { sex = "Male"; }
Hope you have it all figured out now haha


Re: error 001: expected token: ")", but found "]" - Virtual1ty - 13.07.2015

Why did you open another topic? Post the same problem in your old topic.


Re: error 001: expected token: ")", but found "]" - alexanderjb918 - 13.07.2015

bumped with new issue.


Re: error 001: expected token: ")", but found "]" - Virtual1ty - 13.07.2015

It's the same issue as in your other thread and you didn't respond to my post there which has the solution to your issue.


Re: error 001: expected token: ")", but found "]" - alexanderjb918 - 13.07.2015

that is not a solution to my issue the code you sent me im using now and its still giving me errors.


Re: error 001: expected token: ")", but found "]" - TonyVk - 13.07.2015

Can you post "new PlayerData..." line?


Re: error 001: expected token: ")", but found "]" - alexanderjb918 - 13.07.2015

new PlayerData[MAX_PLAYERS][playerData];


Re: error 001: expected token: ")", but found "]" - TonyVk - 13.07.2015

Then try this:

Код:
if(PlayerData[extraid][pGender] == 1) { sex = "Male"; }
if(PlayerData[extraid][pGender] == 2) { sex = "Female"; }