Rather strange dialog problem
#1

pawn Код:
case ListAccountsDialog:
{
    if (!response)
    {
        Kick(playerid);
    }
    else
    {
        print(inputtext);
        if(!strcmp(inputtext, LoginPlayerName[playerid][1]))
        {
            print("1");
            LoadCharacterStats(playerid, LoginPlayerName[playerid][1]);
        }
        else if(!strcmp(inputtext, LoginPlayerName[playerid][2]))
        {
            print("2");
            LoadCharacterStats(playerid, LoginPlayerName[playerid][2]);
        }
        else if(!strcmp(inputtext, LoginPlayerName[playerid][3]))
        {
            print("3");
            LoadCharacterStats(playerid, LoginPlayerName[playerid][3]);
        }
        else if(!strcmp(inputtext, "Register a new character"))
        {
            print("4");
            ShowPlayerDialog(playerid, RegisterNewCharacter, DIALOG_STYLE_INPUT, "New Character", "Type in your new characters name", "Next", "Back");
        }
    }
    return 1;
}
I have a list dialog when you login, where you can pick your character. It then passes it over to OnDialogReponse, which looks like this. What I don't understand is why it jumps to the first function and prints "1". The inputtext prints "Register a new character", still it jumps to the first one. Does anyone have an explanation for why this happening?

I've never encountered anything like this before, so I'm thankful for all the help I can get.
Reply
#2

If one of strings passed to strcmp is empty, then strcmp will return 0. Are you sure LoginPlayerName[playerid][1] is not empty?
Reply
#3

How is 'LoginPlayerName' defined? Is this a three dimensional array?
Reply
#4

Misiur:
That might be it, thank you. I'll check it out.

Vince:
Yes it is.
Reply
#5

Misiur, you were right. Thank you! I'll see if I can get this working now.

Edit:
That worked great. Thanks for the answer, I would've never thought of that! Pretty obvious though
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)