SA-MP Forums Archive
Help with OnDialogResponse - 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: Help with OnDialogResponse (/showthread.php?tid=456703)



Help with OnDialogResponse - Zach7 - 07.08.2013

What's wrong with this?

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//------------------Weapons Dialog-----------------------
    if(dialogid == DIALOG_WEAPONS)
        if(response)
        {
        switch(dialogid)
            {
                case 1://Our Dialog
            {
                switch(listitem)//Checking which was selected
                {
                    case 0://first item
                    {
                        GivePlayerWeapon(playerid, 24, 90);
                    }
                    case 1: //second item
                    {
                        GivePlayerWeapon(playerid, 30, 250);
                    }
                }
            }
        }
        }
    return 1;
    }
//------------Teles Dialog---------------
    if(dialogid == DIALOG_TELES)
        {
        if(response)
            {
            switch(dialogid)
                {
                    case 1:
                }
                    switch(listitem)
                    {
                        case 0:
                        {
                            SetPlayerPos(playerid, 1334.5587,1304.8950,10.5095);
                            SetPlayerInterior(playerid, 0);
                        }
                    }
                }
                }
            }
            return 1;
    }
I keep getting these errors, and it is only on the second dialog menu, which is the teles menu

pawn Код:
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(229) : error 010: invalid function or declaration
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(231) : error 010: invalid function or declaration
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(233) : error 010: invalid function or declaration
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(235) : error 010: invalid function or declaration
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(237) : error 010: invalid function or declaration
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(245) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.



Re: Help with OnDialogResponse - Edix - 07.08.2013

I dont think you understood how to use switch and case.
inside the switch( ) you need to do for example switch(dialogid)


Re: Help with OnDialogResponse - Naruto_Emilio - 07.08.2013

This is pretty fucked up, give me the dialogs code you used like ShowPlayerDialog


Re: Help with OnDialogResponse - Zach7 - 07.08.2013

I changed it, but I get the same errors


Re: Help with OnDialogResponse - Zach7 - 07.08.2013

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
This is pretty fucked up, give me the dialogs code you used like ShowPlayerDialog
pawn Код:
CMD:teles(playerid, params[])
{
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teleport Locations", "LVA\nSFA\nLSA", "OK", "Cancel");
    return 1;
}
Here is the code


Re: Help with OnDialogResponse - PT - 07.08.2013

Try this

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//------------------Weapons Dialog-----------------------
    if(response)
    {
        switch(1)
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0: GivePlayerWeapon(playerid, 24, 90);
                    case 1: GivePlayerWeapon(playerid, 30, 250);
                }
            }
        }
        switch(2) // Teles Dialog
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0:
                    {
                        SetPlayerPos(playerid, 1334.5587,1304.8950,10.5095);
                        SetPlayerInterior(playerid, 0);
                    }
                }
            }
        }
    }
    return 1;
}



Re: Help with OnDialogResponse - Zach7 - 07.08.2013

Quote:
Originally Posted by PT
Посмотреть сообщение
Try this

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//------------------Weapons Dialog-----------------------
    if(response)
    {
        switch(1)
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0: GivePlayerWeapon(playerid, 24, 90);
                    case 1: GivePlayerWeapon(playerid, 30, 250);
                }
            }
        }
        switch(2) // Teles Dialog
        {
            case 1:
            {
                switch(listitem)
                {
                    case 0:
                    {
                        SetPlayerPos(playerid, 1334.5587,1304.8950,10.5095);
                        SetPlayerInterior(playerid, 0);
                    }
                }
            }
        }
    }
    return 1;
}
That didn't work

keep it the way I had it, just tell me how to fix it