SA-MP Forums Archive
Dialog won't response.. - 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 won't response.. (/showthread.php?tid=465334)



Dialog won't response.. - CesarLT - 21.09.2013

Hello everyone, I am having trouble with my dialog, and I don't know what's the problem..

So here are the codes. (The problem is that if I click yes, or neither no, it won't respond, so what's the problem?)
Btw, no errors.

pawn Код:
#define DIALOG_WEAPONSHOP 1

pawn Код:
CMD:weaponshop(playerid, params[])
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "{FF5C5C}Weapon shop", "{FFFFFF}Are you sure that you wish to leave your current position and visit the weapon shop?\n{FF0000}[NOTE]{FFFFFF} - You will return to your past position when you'll exit", "Leave", "Close");
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEAPONSHOP)
    {
        if(response)
        {
            SetPlayerPos(playerid, 2390.3250,1158.0721,744.2016);
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You've decided not to leave to the weapon shop! Have fun.");
           
        }
        return 1;
    }

    return 0;
}

Thanks in advance.


Re: Dialog won't response.. - DanishHaq - 21.09.2013

The show player dialog id is right now "1", either change that number 1 to DIALOG_WEAPONSHOP or change the dialog_weaponshop to the number 1.


Re: Dialog won't response.. - EiresJason - 21.09.2013

Like DanishHaq said; you have to change one or the other.

It's recommended to change the following than the other option though.

pawn Код:
CMD:weaponshop(playerid, params[])
{
    //Use this one.
    ShowPlayerDialog(playerid, DIALOG_WEAPONSHOP , DIALOG_STYLE_MSGBOX, "{FF5C5C}Weapon shop", "{FFFFFF}Are you sure that you wish to leave your current position and visit the weapon shop?\n{FF0000}[NOTE]{FFFFFF} - You will return to your past position when you'll exit", "Leave", "Close");
    return 1;
}
The other option would be this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) //changed DIALOG_WEAPONSHOP to 1.
    {
        if(response)
        {
            SetPlayerPos(playerid, 2390.3250,1158.0721,744.2016);
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You've decided not to leave to the weapon shop! Have fun.");
           
        }
        return 1;
    }

    return 0;
}



Re: Dialog won't response.. - Emmet_ - 21.09.2013

lol at the above posts..

You have to return 0 under OnDialogResponse in your gamemode and any other filterscripts that your server is running.


Re: Dialog won't response.. - CesarLT - 21.09.2013

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
lol at the above posts..

You have to return 0 under OnDialogResponse in your gamemode and any other filterscripts that your server is running.
I am returning 0...


EDIT: ------------------------------

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Like DanishHaq said; you have to change one or the other.

It's recommended to change the following than the other option though.

pawn Код:
CMD:weaponshop(playerid, params[])
{
    //Use this one.
    ShowPlayerDialog(playerid, DIALOG_WEAPONSHOP , DIALOG_STYLE_MSGBOX, "{FF5C5C}Weapon shop", "{FFFFFF}Are you sure that you wish to leave your current position and visit the weapon shop?\n{FF0000}[NOTE]{FFFFFF} - You will return to your past position when you'll exit", "Leave", "Close");
    return 1;
}
The other option would be this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1) //changed DIALOG_WEAPONSHOP to 1.
    {
        if(response)
        {
            SetPlayerPos(playerid, 2390.3250,1158.0721,744.2016);
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "You've decided not to leave to the weapon shop! Have fun.");
           
        }
        return 1;
    }

    return 0;
}
Your solution won't work guys..


Re: Dialog won't response.. - Emmet_ - 21.09.2013

Your dialog ID is in use then.


Re: Dialog won't response.. - CesarLT - 21.09.2013

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
Your dialog ID is in use then.
Well, it's not, and here, the last thing I am seeing is that picture:



And no matter what I click, nothing happens..


Re: Dialog won't response.. - EiresJason - 21.09.2013

Does this work?
pawn Код:
{
CMD:weaponshop(playerid, params[])
{
    //Use this one.
    ShowPlayerDialog(playerid, DIALOG_WEAPONSHOP , DIALOG_STYLE_MSGBOX, "{FF5C5C}Weapon shop", "{FFFFFF}Are you sure that you wish to leave your current position and visit the weapon shop?\n{FF0000}[NOTE]{FFFFFF} - You will return to your past position when you'll exit", "Leave", "Close");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEAPONSHOP )
    {
        if(!response) return SendClientMessage(playerid, COLOR_WHITE, "You've decided not to leave to the weapon shop! Have fun.");
        if(response)
        {
            SetPlayerPos(playerid, 2390.3250,1158.0721,744.2016);
        }
    }

    return 0;
}



Re: Dialog won't response.. - CesarLT - 21.09.2013

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Does this work?
pawn Код:
{
CMD:weaponshop(playerid, params[])
{
    //Use this one.
    ShowPlayerDialog(playerid, DIALOG_WEAPONSHOP , DIALOG_STYLE_MSGBOX, "{FF5C5C}Weapon shop", "{FFFFFF}Are you sure that you wish to leave your current position and visit the weapon shop?\n{FF0000}[NOTE]{FFFFFF} - You will return to your past position when you'll exit", "Leave", "Close");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_WEAPONSHOP )
    {
        if(!response) return SendClientMessage(playerid, COLOR_WHITE, "You've decided not to leave to the weapon shop! Have fun.");
        if(response)
        {
            SetPlayerPos(playerid, 2390.3250,1158.0721,744.2016);
        }
    }

    return 0;
}
That did work! Thanks.


Re: Dialog won't response.. - EiresJason - 22.09.2013

No problem