SA-MP Forums Archive
Rather strange dialog problem - 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: Rather strange dialog problem (/showthread.php?tid=423911)



Rather strange dialog problem - Knappen - 19.03.2013

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.


Re: Rather strange dialog problem - Misiur - 19.03.2013

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


Re: Rather strange dialog problem - Vince - 19.03.2013

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


Re: Rather strange dialog problem - Knappen - 19.03.2013

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

Vince:
Yes it is.


Re: Rather strange dialog problem - Knappen - 19.03.2013

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