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



Dialog response doesn't work - MarkenFrank1 - 14.02.2014

Hi. I've made a warp dialog for my server, but if someone clicks on a warp, they won't warp.
I know that warp 3, 4, 5 and 6 are empty.
This is my code:
Response:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (response)//Als je op "Warp" drukt.
{
switch(dialogid)
{
case 1://Dit zijn de warps
{
switch(listitem)
{

case 0: //Garage
{
SetPlayerPos(playerid, 1980.3363, 1765.5774, 11.6543);
}
case 1://Station
{
SetPlayerPos(playerid, 2766.8821, 1774.3678, 10.8203);
}
case 2://warp3
{
    //Zet hier een positie van een warp neer!
}
case 3://warp4
{
    //Zet hier een positie van een warp neer!
}
case 4://warp5
{
    //Zet hier een positie van een warp neer!
}
case 5://warp6
{
    //Zet hier een positie van een warp neer!
}
}
}
}
return 1;
}
return 0;
}
Command:
pawn Код:
CMD:warps(playerid,params[])
{
ShowPlayerDialog(playerid,1, DIALOG_STYLE_LIST, "Warps", "Garage\nStation\nwarp3\nwarp4\nwarp5\nwarp6", "Warp", "Annuleer");
}



Re: Dialog response doesn't work - Avi Raj - 14.02.2014

enter stuff in other cases too.



Re: Dialog response doesn't work - MarkenFrank1 - 14.02.2014

Still doesn't work...
New code:
Response:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (response)//Als je op "Warp" drukt.
{
switch(dialogid)
{
case 1://Dit zijn de warps
{
switch(listitem)
{

case 0: //Garage
{
SetPlayerPos(playerid, 1980.3363, 1765.5774, 11.6543);
}
case 1://Station
{
SetPlayerPos(playerid, 2766.8821, 1774.3678, 10.8203); //Station
}
}
}
}
return 1;
}
return 0;
}
Command:
pawn Код:
CMD:warps(playerid,params[])
{
ShowPlayerDialog(playerid,1, DIALOG_STYLE_LIST, "Warps", "Garage\nStation", "Warp", "Annuleer");
}



Re: Dialog response doesn't work - MarkenFrank1 - 14.02.2014

Help please?


Re: Dialog response doesn't work - GBLTeam - 14.02.2014

On the top of your gamemode put this:
pawn Код:
#define WARPS 40041
Command:
pawn Код:
CMD:warps(playerid, params[])
{
    {
        ShowPlayerDialog(playerid, WARPS, DIALOG_STYLE_LIST, "{008000}- {FFFFFF}Warps{008000} - {FFFFFF}", "Garage\nStation", "Warp", "Annuleer");
        return 1;
    }
}
Under
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Put this:
pawn Код:
if(dialogid == WARPS) // Dialog
    {
      if(response)
         {
         if(listitem == 0)// (ID: 0)
         {
         SetPlayerPos(playerid, 1980.3363, 1765.5774, 11.6543);
         }
         if(listitem == 1) // (ID: 1)
         {
         SetPlayerPos(playerid, 2766.8821, 1774.3678, 10.8203); //Station
        }
      }
    }
If there no other dialogs then put this full OnDialogResponse:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == WARPS) // Dialog
    {
      if(response)
         {
         if(listitem == 0)// (ID: 0)
         {
         SetPlayerPos(playerid, 1980.3363, 1765.5774, 11.6543);
         }
         if(listitem == 1) // (ID: 1)
         {
         SetPlayerPos(playerid, 2766.8821, 1774.3678, 10.8203); //Station
            }
        }
    }
    return 1;
}



Re: Dialog response doesn't work - Teemo - 14.02.2014

Well try this: (notice: Remove and replace this, then try)

pawn Код:
if(dialogid == 1)
    {
        switch(listitem)
        {
            case 0: //Garage
            {
                SetPlayerPos(playerid, 1980.3363, 1765.5774, 11.6543);
            }
            case 1://Station
            {
                SetPlayerPos(playerid, 2766.8821, 1774.3678, 10.8203); //Station
            }
        }
    }
    return 1;
}
,

If it didn't work, Post a reply


Re: Dialog response doesn't work - MarkenFrank1 - 14.02.2014

Ok thanks, I will try


Re: Dialog response doesn't work - GBLTeam - 14.02.2014

Quote:
Originally Posted by MarkenFrank1
Посмотреть сообщение
Ok thanks, I will try
Try my option i think that best solution for that because if there other Dialogs and they got same ID (1) then there will be a big problem but if there no you can change the:

pawn Код:
#define WARPS 40041
Also its better the use the define text because the numbers are no good Like maybe you forgot that you use the 125 number for dialog and you put it 10 times in other places so thats why i prefer this option.


Re: Dialog response doesn't work - MarkenFrank1 - 14.02.2014

Yes, I think that the if statements are also easier I can't try it now, but if it works I give you rep+


Re: Dialog response doesn't work - Teemo - 14.02.2014

@GBLTeam
pawn Код:
#define WARPS 40041
This line got a error, but i am not sure, i tried to use 5 numbers but the dialog doesn't even show..
I tried using 4 numbers, it works without problems so If i am wrong reply