Dialogs
#1

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:
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
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:
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");
And this is the EditFaction Dialog:
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;
}
I know case i: is where the actual error is
Could anyone give me some help?
Reply
#2

bump
Reply
#3

You're switching between the listitem, i is not included.
Reply
#4

This does not make any sense at all to me. It is completely invalid. Unless your faction ids are sequential and there aren't any gaps, I have no clue as to what you're doing and how to solve this.
Reply
#5

I've fix it. Found a more simple way.
pawn Код:
Dialog:EditFaction(playerid, response, listitem, inputtext[])
{
    i = listitem+1;
    new string[128];
    if(response)
    {
        if(Factions[i][fID] != 0)
        {
            AFactionEdit[playerid] = i;
            format(string, sizeof(string), "%s", Factions[i][fName]);
            ShowDialog(playerid, Show:<EditFaction2>, DIALOG_STYLE_LIST, "EMBED_YELLOW"string"EMBED_CYAN", "Faction Name\nFaction Type\nFaction Color\nFaction Uniform\nFaction Spawn", "Select", "Exit");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)