SA-MP Forums Archive
HELP!?!? Dialog unresponsive. - 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: HELP!?!? Dialog unresponsive. (/showthread.php?tid=192150)



HELP!?!? Dialog unresponsive. - BigAl - 21.11.2010

Hello, can u please help me with my dialog, because it is unresponsive, please help me.

I dont get any errors but, my dialog does not give me any weapons and does not take any money of me :/

PLEASE HELP! Thanks!
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You cancelled!");
                return 1;
            }
           
            switch(listitem)
            {
                case 1:
                {
                    GivePlayerMoney(playerid, -5000);
                    GivePlayerWeapon(playerid, 28, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught a mini uzi with 50 ammunition for $5000!");
                }
                case 2:
                {
                    GivePlayerMoney(playerid, -7000);
                    GivePlayerWeapon(playerid, 30, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught an AK47 with 50 ammunition for $7,000!");
                }
                case 3:
                {
                    GivePlayerMoney(playerid, -10000);
                    GivePlayerWeapon(playerid, 31, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught an M4 carbine with 50 ammunition for $10,000!");
                }
            }
        }
pawn Код:
if(strcmp(cmdtext, "/buy", true) == 0)
    {
    ShowPlayerDialog(playerid,0,DIALOG_STYLE_LIST,"Guns!","1. Uzi\r\n2. Ak47\r\n3. M4","Continue", "Cancel");
    return 1;
    }



Re: HELP!?!? Dialog unresponsive. - WillyP - 21.11.2010

You got two case1:'s in your code.


Re: HELP!?!? Dialog unresponsive. - 0ne - 21.11.2010

U should add if(response) i think.


Re: HELP!?!? Dialog unresponsive. - Victor - 21.11.2010

You have the Dialog Ids messed up.

Change it to this. Also I think the Lists start at 0(not sure)
pawn Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Guns!","1. Uzi\r\n2. Ak47\r\n3. M4","Continue", "Cancel");
Also change the Dialog Response to this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You cancelled!");
                return 1;
            }
           
            switch(listitem)
            {
                case 0:
                {
                    GivePlayerMoney(playerid, -5000);
                    GivePlayerWeapon(playerid, 28, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught a mini uzi with 50 ammunition for $5000!");
                }
                case 1:
                {
                    GivePlayerMoney(playerid, -7000);
                    GivePlayerWeapon(playerid, 30, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught an AK47 with 50 ammunition for $7,000!");
                }
                case 2:
                {
                    GivePlayerMoney(playerid, -10000);
                    GivePlayerWeapon(playerid, 31, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught an M4 carbine with 50 ammunition for $10,000!");
                }
            }
        }
    }
    return 1;
}



Re: HELP!?!? Dialog unresponsive. - WillyP - 21.11.2010

Quote:
Originally Posted by 0ne
Посмотреть сообщение
U should add if(response) i think.
No, you don't.(I think)

Anyways, try this:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_RED, "You cancelled!");
                return 1;
            }
           
            switch(listitem)
            {
                case 1:
                {
                    GivePlayerMoney(playerid, -5000);
                    GivePlayerWeapon(playerid, 28, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught a mini uzi with 50 ammunition for $5000!");
                }
                case 2:
                {
                    GivePlayerMoney(playerid, -7000);
                    GivePlayerWeapon(playerid, 30, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught an AK47 with 50 ammunition for $7,000!");
                }
                case 3:
                {
                    GivePlayerMoney(playerid, -10000);
                    GivePlayerWeapon(playerid, 31, 50);
                    SendClientMessage(playerid, COLOR_PINK, "You have just baught an M4 carbine with 50 ammunition for $10,000!");
                }
            return 1;
        }
And make sure the dialog id's match.


Re: HELP!?!? Dialog unresponsive. - [L3th4l] - 21.11.2010

Victious, it needs the case there, how you think it will switch between dialogs?

--- Don't use Victious' code, it will just give more errors.

EDIT: Try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 1:
                    {
                        GivePlayerMoney(playerid, -5000);
                        GivePlayerWeapon(playerid, 28, 50);
                        SendClientMessage(playerid, COLOR_PINK, "You have just baught a mini uzi with 50 ammunition for $5000!");
                    }
                    case 2:
                    {
                        GivePlayerMoney(playerid, -7000);
                        GivePlayerWeapon(playerid, 30, 50);
                        SendClientMessage(playerid, COLOR_PINK, "You have just baught an AK47 with 50 ammunition for $7,000!");
                    }
                    case 3:
                    {
                        GivePlayerMoney(playerid, -10000);
                        GivePlayerWeapon(playerid, 31, 50);
                        SendClientMessage(playerid, COLOR_PINK, "You have just baught an M4 carbine with 50 ammunition for $10,000!");
                    }
                }
            }
            else SendClientMessage(playerid, COLOR_RED, "You cancelled!");
        }