Weird Problem with dialogs
#1

Hello, I've been converting my old register system to dialogs instead, but it doesn't seem to respond to the second step at all. I've had no problems with dialogs before, but now it just doesn't work.

pawn Код:
enum AllDialogs
{
    FirstRegisterStep,
    SecondRegisterStep,
    ThirdRegisterStep,
    CheckRegisterInfo,
    Login
}
new Dialog[AllDialogs];
pawn Код:
// This happens if you are not registered.
    format(RegisterString, sizeof(RegisterString), "1. Are you a male or a female?");
    ShowPlayerDialog(playerid, Dialog[FirstRegisterStep], DIALOG_STYLE_LIST, RegisterString, "Male\nFemale", "Next", "Exit");
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new RegisterString[60];
    if(dialogid == Dialog[FirstRegisterStep])
    {
        if(!response) // Exit
        {
            SendClientMessage(playerid, COLOR_RED, "Immigration Department: Here's your tickets back. These men will escort you back.");
            Kick(playerid);
        }
        else
        {
            if(listitem == 0) // Male
            {
                new maleskin;
                maleskin = random(sizeof(CivMalePeds));
                PlayerInfo[playerid][pChar] = maleskin;
                PlayerInfo[playerid][pSex] = 1;
                print("Step 1");
                format(RegisterString, sizeof(RegisterString), "2. What is your birthdate? (Use dd/mm/yyyy)");
                ShowPlayerDialog(playerid, Dialog[SecondRegisterStep], DIALOG_STYLE_INPUT, "Date of Birth", RegisterString, "Next", "Exit");
                print("Step 2");
            }
            else if(listitem == 1) // Female
            {
                new femaleskin;
                femaleskin = random(sizeof(CivFemalePeds));
                PlayerInfo[playerid][pChar] = femaleskin;
                PlayerInfo[playerid][pSex] = 2;
                format(RegisterString, sizeof(RegisterString), "2. What is your birthdate? (Use dd/mm/yyyy)");
                ShowPlayerDialog(playerid, Dialog[SecondRegisterStep], DIALOG_STYLE_INPUT, "Date of Birth", RegisterString, "Next", "Exit");
            }
        }
        return 1;
    }
    else if(dialogid == Dialog[SecondRegisterStep])
    {
        if(!response) // Exit
        {
            SendClientMessage(playerid, COLOR_RED, "Immigration Department: Here's your tickets back. These men will escort you back.");
            Kick(playerid);
        }
        else
        {
            print("Step 3");
            if(GetPlayerAge(inputtext) == 0)
            {
                print("Test 1");
                format(RegisterString, sizeof(RegisterString), "2. What is your birthdate? (Use dd/mm/yyyy)");
                ShowPlayerDialog(playerid, Dialog[SecondRegisterStep], DIALOG_STYLE_INPUT, "Date of Birth", RegisterString, "Next", "Exit");
            }
            print("Test 2");
            new Age = GetPlayerAge(inputtext);
            new DateOfBirth[20];
            format(DateOfBirth, sizeof(DateOfBirth), "%s", inputtext);
            strmid(PlayerInfo[playerid][pBirthday], DateOfBirth, 0, strlen(DateOfBirth), 255);
            PlayerInfo[playerid][pAge] = Age;
            format(RegisterString, sizeof(RegisterString), "3. What is your origin?");
            ShowPlayerDialog(playerid, Dialog[ThirdRegisterStep], DIALOG_STYLE_LIST, RegisterString, "America \nEurope \nAsia \nAfrica", "Next", "Exit");
        }
        return 1;
    }
    else if(dialogid == Dialog[ThirdRegisterStep])
    {
        if(!response) // Exit
        {
            SendClientMessage(playerid, COLOR_RED, "Immigration Department: Here's your tickets back. These men will escort you back.");
            Kick(playerid);
        }
        else
        {
            new CheckInfo[150];
            new Sex[5];
            new Age = PlayerInfo[playerid][pAge];
            if(PlayerInfo[playerid][pSex] == 1)
            {
                strmid(Sex, "Male", 0, strlen("Male"), 255);
            }
            else if(PlayerInfo[playerid][pSex] == 2)
            {
                strmid(Sex, "Female", 0, strlen("Female"), 255);
            }
            if(CompareStrings(inputtext, "usa"))
            {
                PlayerInfo[playerid][pOrigin] = 1;
                SavePlayerSQL(playerid);
                format(CheckInfo, sizeof(CheckInfo), "Are you sure all of this is correct? \nSex: %s \nAge: %d \nOrigin: America", Sex, Age);
                ShowPlayerDialog(playerid, Dialog[CheckRegisterInfo], DIALOG_STYLE_MSGBOX, "Immigration Registration Form", CheckInfo, "Turn in", "Fill out a new one");
            }
            else if(CompareStrings(inputtext, "europe"))
            {
                PlayerInfo[playerid][pOrigin] = 2;
                RegistrationStep[playerid] = 0;
                format(CheckInfo, sizeof(CheckInfo), "Are you sure all of this is correct? \nSex: %s \nAge: %d \nOrigin: Europe", Sex, Age);
                ShowPlayerDialog(playerid, Dialog[CheckRegisterInfo], DIALOG_STYLE_MSGBOX, "Immigration Registration Form", CheckInfo, "Turn in", "Fill out a new one");
            }
            else if(CompareStrings(inputtext, "asia"))
            {
                PlayerInfo[playerid][pOrigin] = 3;
                RegistrationStep[playerid] = 0;
                format(CheckInfo, sizeof(CheckInfo), "Are you sure all of this is correct? \nSex: %s \nAge: %d \nOrigin: Asia", Sex, Age);
                ShowPlayerDialog(playerid, Dialog[CheckRegisterInfo], DIALOG_STYLE_MSGBOX, "Immigration Registration Form", CheckInfo, "Turn in", "Fill out a new one");
            }
            else if(CompareStrings(inputtext, "africa"))
            {
                PlayerInfo[playerid][pOrigin] = 4;
                RegistrationStep[playerid] = 0;
                format(CheckInfo, sizeof(CheckInfo), "Are you sure all of this is correct? \nSex: %s \nAge: %d \nOrigin: Africa", Sex, Age);
                ShowPlayerDialog(playerid, Dialog[CheckRegisterInfo], DIALOG_STYLE_MSGBOX, "Immigration Registration Form", CheckInfo, "Turn in", "Fill out a new one");
            }
            else
            {
                SendErrorMessage(playerid, "* You sure you got that right?");
                format(RegisterString, sizeof(RegisterString), "3. What is your origin?");
                ShowPlayerDialog(playerid, Dialog[FirstRegisterStep], DIALOG_STYLE_LIST, RegisterString, "America \nEurope \nAsia \nAfrica", "Next", "Exit");
            }
        }
        return 1;
    }
    else if(dialogid == Dialog[CheckRegisterInfo])
    {
        if(!response) // Fill out a new one
        {
            format(RegisterString, sizeof(RegisterString), "1. Are you a male or a female?");
            ShowPlayerDialog(playerid, Dialog[FirstRegisterStep], DIALOG_STYLE_INPUT, "Sex", RegisterString, "Next", "Exit");
        }
        else
        {
            new FirstName[50];
            FirstName = GetPlayerFirstName(playerid);
            new LastName[50];
            LastName = GetPlayerLastName(playerid);
            RegisterFriends(playerid);
            strmid(NameTagInfo[playerid][nFirstName], FirstName, 0, strlen(FirstName), 255);
            strmid(NameTagInfo[playerid][nLastName], LastName, 0, strlen(LastName), 255);
            SendClientMessage(playerid, COLOR_INFO, "Immigration Department: Thank you for filling in all the information.");
            SendClientMessage(playerid, COLOR_INFO, "Immigration Department: You will be taken to the tutorial now.");
            TutTime[playerid] = 1;
        }
        return 1;
    }
    return 0;
}
As you can see I've been trying do a little debugging. The first dialog works perfect, but the second one doesn't respond. It completes Step 1 and 2 from the first dialog, but does not print Step 3, which is before it even starts to do anything, so it doesn't even get that far.

I would really appreciate some help and perhaps some ideas on how to improve it and make it better and easier, and maybe a bit more realistic!
Reply


Messages In This Thread
Weird Problem with dialogs - by Knappen - 02.08.2012, 19:05
Re: Weird Problem with dialogs - by Knappen - 02.08.2012, 21:09
Re: Weird Problem with dialogs - by Knappen - 03.08.2012, 11:52
Re: Weird Problem with dialogs - by Misiur - 03.08.2012, 12:17
Re: Weird Problem with dialogs - by Vince - 03.08.2012, 12:26
Re: Weird Problem with dialogs - by Knappen - 03.08.2012, 20:01

Forum Jump:


Users browsing this thread: 1 Guest(s)