Dialog response doesn't work
#1

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");
}
Reply
#2

enter stuff in other cases too.
Reply
#3

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");
}
Reply
#4

Help please?
Reply
#5

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;
}
Reply
#6

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
Reply
#7

Ok thanks, I will try
Reply
#8

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.
Reply
#9

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

@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
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)