Problem to show next dialog on player SetPlayerSpawn (Editing only to learn)
#1

The first dialog shows up but the next one isn't showing. (You can see on dialog response in next peace of code)
pawn Код:
SetPlayerSpawn(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pTut] == 0)
        {
            gOoc[playerid] = 1; gNews[playerid] = 1; gFam[playerid] = 1;
            TogglePlayerControllable(playerid,0);
            SetPlayerColor(playerid,TEAM_HIT_COLOR);
            SetPlayerPos(playerid, 766.50, -1684.32, -6.86);
            SetPlayerCameraPos(playerid, 751.93, -1673.95, 16.01);
            SetPlayerCameraLookAt(playerid, 699.55, -1628.93, 5.88);
            RegistrationStep[playerid] = 2;
            ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
            SetPlayerVirtualWorld(playerid, 1984);
            return 1;
        }
    return 1;
}
So basicly this is the one and here is my list what I want to show in dialogs..

pawn Код:
if(dialogid == dregister1)
    {
        if(RegistrationStep[playerid] == 1)
        {
            if(response) // If they clicked 'Male' or pressed enter
            {
                if(strlen(inputtext))
                {
                    new year, month,day;
                    getdate(year, month, day);
                    new DateInfo[3][20];
                    splits(inputtext, DateInfo, '/');
                    if(year - strval(DateInfo[2]) > 100 || strval(DateInfo[2]) < 1 || strval(DateInfo[2]) >= year)
                    {
                        ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
                    }
                    new check = year - strval(DateInfo[2]);
                    if(check == year)
                    {
                        ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
                    }
                    if(strval(DateInfo[1]) > month)
                    {
                        check -= 1;
                    }
                    else if(strval(DateInfo[1]) == month && strval(DateInfo[0]) > day)
                    {
                        check -= 1;
                    }
                    PlayerInfo[playerid][pAge] = check;
                    ShowPlayerDialog(playerid, dregister2, DIALOG_STYLE_LIST, "Okay. Where are you from?","Los Santos\nSan Fierro\nLiberty City\n", "Select", "Cancel");
                    RegistrationStep[playerid] = 2;
                }
            }
        }
    }
    if (dialogid == dregister2)
    {
        if(RegistrationStep[playerid] == 2)
        {
            if (response)
            {
                if (listitem == 0)
                {
                    PlayerInfo[playerid][pCity] = 0;
                    SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from Los Santos");
                }
                if (listitem == 1)
                {
                    PlayerInfo[playerid][pCity] = 1;
                    SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from San Fierro");
                }
                if (listitem == 2)
                {
                    PlayerInfo[playerid][pCity] = 2;
                    SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from Los Venturas");
                }
                if (listitem == 3)
                {
                    PlayerInfo[playerid][pCity] = 3;
                    SendClientMessage(playerid, COLOR_GREEN, "Okay,So you are from Liberty City");
                }
                RegistrationStep[playerid] = 3;
            }
        }
        return 0;
    }
Reply
#2

Someone please ... Just It's more then 24 h... I even didn't slept because I want to know how the F I can do it.. Tryed a lot of things out...... But as you can see I'm here!

I'm just desperet.. I don't know what to do anymore .. And I don't want to go to bed till I will fix this code

Sorry for bump so early...
Reply
#3

Learn to debug, it'll save a lot of trouble. Learn how to use variables. That will save a lot of CPU usage. I've used sscanf instead your splits, so I don't have to use strval.

Before
pawn Код:
if(dialogid == dregister1)
    {
        if(RegistrationStep[playerid] == 1)
        {
            if(response) // If they clicked 'Male' or pressed enter
            {
                if(strlen(inputtext))
                {
                    new year, month,day;
                    getdate(year, month, day);
                    new DateInfo[3][20];
                    splits(inputtext, DateInfo, '/');
                    if(year - strval(DateInfo[2]) > 100 || strval(DateInfo[2]) < 1 || strval(DateInfo[2]) >= year)
                    {
                        ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
                    }
                    new check = year - strval(DateInfo[2]);
                    if(check == year)
                    {
                        ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
                    }
                    if(strval(DateInfo[1]) > month)
                    {
                        check -= 1;
                    }
                    else if(strval(DateInfo[1]) == month && strval(DateInfo[0]) > day)
                    {
                        check -= 1;
                    }
                    PlayerInfo[playerid][pAge] = check;
                    ShowPlayerDialog(playerid, dregister2, DIALOG_STYLE_LIST, "Okay. Where are you from?","Los Santos\nSan Fierro\nLiberty City\n", "Select", "Cancel");
                    RegistrationStep[playerid] = 2;
                }
            }
        }
    }
After
pawn Код:
if(dialogid == dregister1)
{
    if(RegistrationStep[playerid] == 1)
    {
        if(response && strlen(inputtext))
        {
            new year, month, day;
            getdate(year, month, day);
            new DateInfo[3];
            sscanf(inputtext, "p</>ddd", DateInfo[0], DateInfo[1], DateInfo[2]);
            //Ultrayoung or ultraold
            new age = year - DateInfo[2];
            if(1 > age > 100)
            {
                ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
            }
            if(DateInfo[1] > month || (DateInfo[1] == month && DateInfo[0] > day)) age -= 1;
            PlayerInfo[playerid][pAge] = age;
            ShowPlayerDialog(playerid, dregister2, DIALOG_STYLE_LIST, "Okay. Where are you from?","Los Santos\nSan Fierro\nLiberty City\n", "Select", "Cancel");
            RegistrationStep[playerid] = 2;
        }
    }
}
#e: In case this still doesn't work, debug information everywhere (will pop up in console)

pawn Код:
if(dialogid == dregister1)
{
    if(RegistrationStep[playerid] == 1)
    {
        print("Reached point 1");
        if(response && strlen(inputtext))
        {
            print("Reached point 2");
            new year, month, day;
            getdate(year, month, day);
            new DateInfo[3];
            sscanf(inputtext, "p</>ddd", DateInfo[0], DateInfo[1], DateInfo[2]);
            printf("Data: %d/%02d/%02d, from input %d/%02d/%02d", year, month, day, DateInfo[0], DateInfo[1], DateInfo[2]);
            new age = year - DateInfo[2];
            printf("Age is %d", age);
            if(1 > age > 100)
            {
                return ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
            }
            if(DateInfo[1] > month || (DateInfo[1] == month && DateInfo[0] > day)) age -= 1;
            printf("Age is now %d", age);
            PlayerInfo[playerid][pAge] = age;
            ShowPlayerDialog(playerid, dregister2, DIALOG_STYLE_LIST, "Okay. Where are you from?","Los Santos\nSan Fierro\nLiberty City\n", "Select", "Cancel");
            print("Done");
            RegistrationStep[playerid] = 2;
        }
    }
}
Reply
#4

Edit even didnt pop up!! But dialog showed up!
Reply
#5

Bump! Really need to udestend whats wrong with it! so basiclly it calls
if(PlayerInfo[playerid][pTut] == 0)
{
print("Reached point 3");

But the others he dont. what could be the problem!
Reply
#6

What do you see in console? (using version with debug data)
Reply
#7

As I said it doesn't call under dialog.. but it calls out

if(PlayerInfo[playerid][pTut] == 0)
{
print("Reached point 3");

So the question is why its not reading uder OnDialog,
Reply
#8

(in setplayerspawn)
pawn Код:
RegistrationStep[playerid] = 2;
ShowPlayerDialog(playerid,dregister1,DIALOG_STYLE_INPUT,"Error","When is your Birthday? ( DD/MM/YYYY )","Enter","Cancel");
Take a look. You are setting step to 2, then showing the dialog dregister1. Now:
pawn Код:
if(dialogid == dregister1)
{
    if(RegistrationStep[playerid] == 1)
    {
You are checking if dialog has id dregister1 (it has). Next you are checking if registrationstep for player is equal 1. Well, no, it is equal 2 because you've set it to 2 earlier.

#e: Wait, not necessarily this, let me think
#e2: Well, just try changing it and tell me if something changes
Reply
#9

Still nothing....
Reply
#10

Did you do:

pawn Код:
//1. in SetPlayerSpawn
RegistrationStep[playerid] = 2;
//to
RegistrationStep[playerid] = 1;
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)