Need help with dialogs not showing up.
#1

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

bump, I really need help.
Reply
#3

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

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

Show your "ShowPlayerDialog" DIALOG_BANK
Reply
#6

Код:
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;
}
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)