SA-MP Forums Archive
Need help with dialogs not showing up. - 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: Need help with dialogs not showing up. (/showthread.php?tid=452734)



Need help with dialogs not showing up. - Prostilov - 22.07.2013

Hello everyone,

I am having some issues with dialogs, well not really, as far is I know this piece of code is supposed to work as it works in all of my other code.

The problem is when I type /bank it shows DIALOG_BANK, but when I choose one of the items that are listed, none of the dialogs show up, nothing happens when clicking any of the items.

I have tried several things, but same result.

Can somebody please take a look at this code and tell what's wrong?

Код:
	if(dialogid == DIALOG_BANK)
	{
		if(response)
		{
			
	    	switch(listitem)
	    	{
	        	case 0:
				{
    				new string[128];
					format(string, sizeof(string), "{3BB9FF}You have {008000}$%i {3BB9FF}in your bank.", PlayerInfo[playerid][pBank]);
					strcat(string, "\nHow much would you like to withdraw?");
					ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdrawal", string, "Confirm", "Cancel");
				}
	        	case 1:
				{
			 		ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit", "How much would you like to deposit?", "Confirm", "Cancel");
				}
	        	case 2:
				{
					SendClientMessage(playerid, COLOR_GREY, "This feature is currently being developed.");
				}
			}
		}
		return 1;
	}
	
	if(dialogid == DIALOG_WITHDRAW)
	{
	    if(response)
	    {
			if(!IsNumeric(inputtext))
			{
			    new cash;
			    cash = strval(inputtext);
			    if(cash <= PlayerInfo[playerid][pBank])
			    {
			        PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank] - cash;
					GivePlayerCash(playerid, cash);
				}
				else SendClientMessage(playerid, COLOR_GREY, "You don't have enough money in your bank account.");
			}
			else SendClientMessage(playerid, COLOR_GREY, "The amount entered is not numeric!");
		}
	}

	if(dialogid == DIALOG_DEPOSIT)
	{
	    if(response)
	    {
			if(!IsNumeric(inputtext))
			{
			    new cash;
			    cash = strval(inputtext);
			    if(cash <= PlayerInfo[playerid][pCash])
			    {
			        GivePlayerCash(playerid, -cash);
					PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank] + cash;
				}
				else SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you.");
			}
			else SendClientMessage(playerid, COLOR_GREY, "The amount entered is not numeric!");
		}
	}



Re: Need help with dialogs not showing up. - Prostilov - 22.07.2013

bump, I really need help.


Re: Need help with dialogs not showing up. - PT - 23.07.2013

try this form

pawn Код:
if(dialogid == DIALOG_BANK)
    {
        if(response)
        {
           
            switch(listitem)
            {
                case 0:
                {
                    new string[128];
                    format(string, sizeof(string), "{3BB9FF}You have {008000}$%i {3BB9FF}in your bank.", PlayerInfo[playerid][pBank]);
                    strcat(string, "\nHow much would you like to withdraw?");
                    ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdrawal", string, "Confirm", "Cancel");
                }
                case 1:
                {
                    ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit", "How much would you like to deposit?", "Confirm", "Cancel");
                }
                case 2:
                {
                    SendClientMessage(playerid, COLOR_GREY, "This feature is currently being developed.");
                }
            }
        }
    }
   
    if(dialogid == DIALOG_WITHDRAW)
    {
        if(response)
        {
            if(!IsNumeric(inputtext))
            {
                new cash;
                cash = strval(inputtext);
                if(cash <= PlayerInfo[playerid][pBank])
                {
                    PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank] - cash;
                    GivePlayerCash(playerid, cash);
                }
                else SendClientMessage(playerid, COLOR_GREY, "You don't have enough money in your bank account.");
            }
            else SendClientMessage(playerid, COLOR_GREY, "The amount entered is not numeric!");
        }
    }

    if(dialogid == DIALOG_DEPOSIT)
    {
        if(response)
        {
            if(!IsNumeric(inputtext))
            {
                new cash;
                cash = strval(inputtext);
                if(cash <= PlayerInfo[playerid][pCash])
                {
                    GivePlayerCash(playerid, -cash);
                    PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank] + cash;
                }
                else SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you.");
            }
            else SendClientMessage(playerid, COLOR_GREY, "The amount entered is not numeric!");
        }
    }



Re: Need help with dialogs not showing up. - Aerotactics - 23.07.2013

Check that the dialog id is different than any others in your server, because it sounds like you might have double ids, which will cause the dialog to not return anything


Re: Need help with dialogs not showing up. - ThePhenix - 23.07.2013

Show your "ShowPlayerDialog" DIALOG_BANK


Re: Need help with dialogs not showing up. - Prostilov - 23.07.2013

Код:
CMD:bank(playerid, params [])
{
	if(!IsPlayerInRangeOfPoint(playerid, 15.0, 2315.952880, -1.618174, 26.742187)) return SendClientMessage(playerid, COLOR_GREY, "You need to be in a bank!");
	ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "Bank", "Withdraw\nDeposit\nTransfer", "Confirm", "Cancel");
	return 1;
}



Re: Need help with dialogs not showing up. - Prostilov - 23.07.2013

Never mind, I fixed it, it was a dumb mistake on my part, thanks for the help regardless!