SA-MP Forums Archive
Dialog help, the "cancel" kick is being called even if you dont cancel - 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: Dialog help, the "cancel" kick is being called even if you dont cancel (/showthread.php?tid=424596)



Dialog help, the "cancel" kick is being called even if you dont cancel - Don_Cage - 23.03.2013

So this is my code
pawn Код:
if(dialogid == 5013)
        {
            if(response)
            {
                if(listitem == 0)
                {
                    PlayerInfo[playerid][pSex] = 1;
                    PlayerInfo[playerid][pChar] = 26;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_INPUT,"Ah","So you are a male.Well how old are you?","Select","Cancel");
                }
                else if(listitem == 1)
                {
                    PlayerInfo[playerid][pSex] = 2;
                    PlayerInfo[playerid][pChar] = 91;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_LIST,"Ah","So you are a female.Well how old are you?","Select","Cancel");
                }
                else
                {
                    Kick(playerid)
                }
            }
        }
        if(dialogid == 5014)
        {
            if(response)
            {
                new age = strval(inputtext);
                PlayerInfo[playerid][pAge] = age;
                new Orgin[] = "I'm from America\nI'm from Europe\nI'm from Asia\nI'm from Africa";
                ShowPlayerDialog(playerid, 5015,DIALOG_STYLE_LIST,"So where are you from?",Orgin,"Select","Cancel");
            }
            else
            {
                Kick(playerid)//This kick is being called no mather what you choose
            }
        }



Re: Dialog help, the "cancel" kick is being called even if you dont cancel - HurtLocker - 23.03.2013

Try this, I added some returns:
pawn Код:
if(dialogid == 5013)
{
    if(response)
    {
        if(listitem == 0)
        {
            PlayerInfo[playerid][pSex] = 1;
            PlayerInfo[playerid][pChar] = 26;
            ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_INPUT,"Ah","So you are a male.Well how old are you?","Select","Cancel");
        }
        else if(listitem == 1)
        {
            PlayerInfo[playerid][pSex] = 2;
            PlayerInfo[playerid][pChar] = 91;
            return ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_LIST,"Ah","So you are a female.Well how old are you?","Select","Cancel");
        }
        else
        {
                    Kick(playerid)
        }
    }
}
if(dialogid == 5014)
{
    if(response)
    {
        new age = strval(inputtext);
        PlayerInfo[playerid][pAge] = age;
        new Orgin[] = "I'm from America\nI'm from Europe\nI'm from Asia\nI'm from Africa";
        return ShowPlayerDialog(playerid, 5015,DIALOG_STYLE_LIST,"So where are you from?",Orgin,"Select","Cancel");
    }
    else
    {
        Kick(playerid)//This kick is being called no mather what you choose
    }
}



Re: Dialog help, the "cancel" kick is being called even if you dont cancel - Don_Cage - 23.03.2013

Thanks, Will try it out now


Re: Dialog help, the "cancel" kick is being called even if you dont cancel - Don_Cage - 23.03.2013

Still same problem


Re: Dialog help, the "cancel" kick is being called even if you dont cancel - kamzaf - 23.03.2013

This should fix the problem, i dont see anything wrong with teh ondialogresponse. if it still doesnt work please show the showplayerdialog line.
pawn Код:
if(dialogid == 5013)
        {
            if(response)
            {
                if(listitem == 0)
                {
                    PlayerInfo[playerid][pSex] = 1;
                    PlayerInfo[playerid][pChar] = 26;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_INPUT,"Ah","So you are a male.Well how old are you?","Select","Cancel");
                }
                else if(listitem == 1)
                {
                    PlayerInfo[playerid][pSex] = 2;
                    PlayerInfo[playerid][pChar] = 91;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_LIST,"Ah","So you are a female.Well how old are you?","Select","Cancel");
                }
                else
                {
                    Kick(playerid)
                }
            }
            return 1;
        }
        if(dialogid == 5014)
        {
            if(response)
            {
                new age = strval(inputtext);
                PlayerInfo[playerid][pAge] = age;
                new Orgin[] = "I'm from America\nI'm from Europe\nI'm from Asia\nI'm from Africa";
                ShowPlayerDialog(playerid, 5015,DIALOG_STYLE_LIST,"So where are you from?",Orgin,"Select","Cancel");
            }
            else
            {
                Kick(playerid)//This kick is being called no mather what you choose
            }
            return 1;
        }



Re: Dialog help, the "cancel" kick is being called even if you dont cancel - Don_Cage - 23.03.2013

Will try it, Thanks


Re: Dialog help, the "cancel" kick is being called even if you dont cancel - Don_Cage - 23.03.2013

Nope still didnt work


Re: Dialog help, the "cancel" kick is being called even if you dont cancel - PaulDinam - 23.03.2013

This would work.

pawn Код:
if(dialogid == 5013)
        {
            if(response)
            {
                if(listitem == 0)
                {
                    PlayerInfo[playerid][pSex] = 1;
                    PlayerInfo[playerid][pChar] = 26;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_INPUT,"Ah","So you are a male.Well how old are you?","Select","Cancel");
                }
                else if(listitem == 1)
                {
                    PlayerInfo[playerid][pSex] = 2;
                    PlayerInfo[playerid][pChar] = 91;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_LIST,"Ah","So you are a female.Well how old are you?","Select","Cancel");
                }
            }
            else
            {
                Kick(playerid)
            }
            return 1;
        }
        if(dialogid == 5014)
        {
            if(response)
            {
                new age = strval(inputtext);
                PlayerInfo[playerid][pAge] = age;
                new Orgin[] = "I'm from America\nI'm from Europe\nI'm from Asia\nI'm from Africa";
                ShowPlayerDialog(playerid, 5015,DIALOG_STYLE_LIST,"So where are you from?",Orgin,"Select","Cancel");
            }
            else
            {
                Kick(playerid)//This kick is being called no mather what you choose
            }
            return 1;
        }
you have placed this:
pawn Код:
else
            {
                Kick(playerid)
            }
Inside the response statement.


Re: Dialog help, the "cancel" kick is being called even if you dont cancel - Don_Cage - 23.03.2013

That looks the same to me?


Re: Dialog help, the "cancel" kick is being called even if you dont cancel - PaulDinam - 23.03.2013

In your old code it was like that:

pawn Код:
if(response)
            {
                if(listitem == 0)
                {
                    PlayerInfo[playerid][pSex] = 1;
                    PlayerInfo[playerid][pChar] = 26;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_INPUT,"Ah","So you are a male.Well how old are you?","Select","Cancel");
                }
                else if(listitem == 1)
                {
                    PlayerInfo[playerid][pSex] = 2;
                    PlayerInfo[playerid][pChar] = 91;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_LIST,"Ah","So you are a female.Well how old are you?","Select","Cancel");
                }
                else
                {
                    Kick(playerid)
                }
            }
And NOW:
pawn Код:
if(response)
            {
                if(listitem == 0)
                {
                    PlayerInfo[playerid][pSex] = 1;
                    PlayerInfo[playerid][pChar] = 26;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_INPUT,"Ah","So you are a male.Well how old are you?","Select","Cancel");
                }
                else if(listitem == 1)
                {
                    PlayerInfo[playerid][pSex] = 2;
                    PlayerInfo[playerid][pChar] = 91;
                    ShowPlayerDialog(playerid, 5014,DIALOG_STYLE_LIST,"Ah","So you are a female.Well how old are you?","Select","Cancel");
                }
            }
            else
            {
                Kick(playerid)
            }
Man.. just look good don't reply immediately