SA-MP Forums Archive
Dialogs - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialogs (/showthread.php?tid=158811)



Dialogs - ScottCFR - 11.07.2010

It's been a while since I've had to post here. But this is really stumping me. I've made a dialog teleport system, when I go in-game and try it out it teles me to one location out of the 10 or so on there. I've changed and re-made it twice. I don't get any error code either. Heres the code.

Command:
pawn Код:
if(!strcmp(cmdtext, "/teles", true))
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Teleports","Las Venturas Teleport List\nSkyDive Teleport List","Go!","Cancel");
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 0)
    {
        switch(response)
        {
            case 1:
            {
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "LV Teleports","Airport\nArea 51\nAbandon Airport\nBig Jump\nPirate Ship\nCraw Bar\nAmmunation","Go!","Cancel");
            }
            case 2:
            {
                ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "LV SkyDives","Skydive #1\nSkydive #2\nSkydive #3\nSkydive #4","Go!","Cancel");
            }
        }
    }
    if(dialogid == 1)
    {
        switch(response)
        {
            case 1:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 1529.1760,1592.9885,11.5522);
            }
            case 2:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 332.5118,1897.7848,18.3585);
            }
            case 3:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 250.0892,2510.0618,17.2614);
            }
            case 4:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, -728.7404,2397.4702,128.0639);
            }
            case 5:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 2003.1655,1544.4967,13.5859);
            }
            case 6:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 2437.9180,2054.7251,10.4362);
            }
            case 7:
            {
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 2532.6929,2083.1746,10.8203);
            }
        }
    }
    if(dialogid == 2)
    {
        switch(response)
        {
            case 1:
            {
                GivePlayerWeapon(playerid, 46, 1);
                GameTextForPlayer(playerid, "Don't forget to pull your chute!", 5000, 5);
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 2057.8674,2435.8203,165.6172);
            }
            case 2:
            {
                GivePlayerWeapon(playerid, 46, 1);
                GameTextForPlayer(playerid, "Don't forget to pull your chute!", 5000, 5);
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 1937.7056,1914.0211,122.0156);
            }
            case 3:
            {
                GivePlayerWeapon(playerid, 46, 1);
                GameTextForPlayer(playerid, "Don't forget to pull your chute!", 5000, 5);
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 2054.0256,1574.7064,520.6119);
            }
            case 4:
            {
                GivePlayerWeapon(playerid, 46, 1);
                GameTextForPlayer(playerid, "Don't forget to pull your chute!", 5000, 5);
                SetPlayerInterior(playerid, 0);
                SetPlayerPos(playerid, 1543.0779,-1354.4495,329.4720);
            }
        }
    }
    return 1;
}



Re: Dialogs - Betamaster - 11.07.2010

switch(response) should be switch(listitem) for the dialog 1 and 2 input selection tests.


Re: Dialogs - ScottCFR - 11.07.2010

Yeah, I changed that right after the post. But now, if you click Area 51 it teles me to the LV Airport, Abandon Airport teles me to area 51. and the skydive menu still doesn't work.


Re: Dialogs - Betamaster - 11.07.2010

listitem is 0 for the first item, not 1.


Re: Dialogs - GangsTa_ - 11.07.2010

Yeah, you should start with 0 list item, then the first will be "second"


Re: Dialogs - ScottCFR - 11.07.2010

I know, having a bad day lol. But this may be my stupidity or not but now, when try to use the skydive part. It goes to the lv tele. If i put the LVtele to 0 and skydive on 1 sky works but lv tele doesn't.

NOTE: srry for bad grammer its late and im tired lol


Re: Dialogs - MikkelGutten - 11.07.2010

Why do you use case? can't you use the following method?
pawn Код:
if(listitem == 0)
{
// Code Here
{
else if(listitem == 1)
{
// Code Here
}
// ...



Re: Dialogs - Grim_ - 11.07.2010

It's all preference on which you use.


Re: Dialogs - MikkelGutten - 11.07.2010

Quote:
Originally Posted by Grim_
Посмотреть сообщение
It's all preference on which you use.
Is the one faster than the other method?


Re: Dialogs - Grim_ - 11.07.2010

To my knowledge, I want to say using switch() is faster, but I'm not completely sure.