14.12.2013, 06:19
Hey Guys,
Can someone please help me with this issue.
I am trying to basicly trying to show all the factions in the server on the first dialog. That's fine.
But how can I detect what the player has chosen?
What I currently have returns this error:
Before you reply after seeing this please look at the code to figure out what I can do to avoid this and the code successfully work.
So everything is connected to MySQL, and the faction system is dynamic so I can't just simply type the names of the fields in as it won't work and factions will be created/deleted ingame without the need of scripting them in.
So here is my code:
First Dialog has this in it to show the List of Factions:
And this is the EditFaction Dialog:
I know case i: is where the actual error is
Could anyone give me some help?
Can someone please help me with this issue.
I am trying to basicly trying to show all the factions in the server on the first dialog. That's fine.
But how can I detect what the player has chosen?
What I currently have returns this error:
pawn Код:
error 002: only a single statement (or expression) can follow each "case"
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 017: undefined symbol "i"
fatal error 107: too many error messages on one line
So everything is connected to MySQL, and the faction system is dynamic so I can't just simply type the names of the fields in as it won't work and factions will be created/deleted ingame without the need of scripting them in.
So here is my code:
First Dialog has this in it to show the List of Factions:
pawn Код:
for(new i = 0; i < MAX_FACTIONS; i++)
{
if(Factions[i][fID] != 0)
{
format(string, sizeof(string), "%s%s\n", string, Factions[i][fName]);
}
}
ShowDialog(playerid, Show:<EditFaction>, DIALOG_STYLE_LIST, ""EMBED_YELLOW"Select Faction to Edit"EMBED_CYAN"", string, "Edit", "Go Back");
pawn Код:
Dialog:EditFaction(playerid, response, listitem, inputtext[])
{
new string[2000];
if(response)
{
switch(listitem)
{
for(new i = 0; i < MAX_FACTIONS; i++)
{
case i: //The Error
{
if(Factions[i][fID] != 0)
{
AFactionEdit[playerid] = i;
format(string, sizeof(string), "You have Chosen: %s", Factions[i][fName]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
}
return 1;
}
Could anyone give me some help?