help with emmet's dialogs include [SOLVED]
#1

Hey, so I'm currently working on a fishing system but there was an error occurred inside the server.
It's compiling perfect, but inside the server whenever I leave the dialog, it force me to purchase the item I listed.
Here is the code:
Код:
Dialog:fishtools(playerid, response, listitem, inputtext[])
{
	    if(listitem == 0)
	    {
	        if(GetPlayerMoney(playerid) >= FishingToolPrice)
			{
				SendServerMessage(playerid, "You have purchased a fishing tools, now you are free to /fish in the water, or in the fishing square at your left.");
		        FishingTool[playerid] = 1;
		        GiveMoney(playerid, -FishingToolPrice);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "ERROR: You don't have enough money");
			}
		}
		if(listitem == 1)
		{
		    Dialog_Show(playerid, worms, DIALOG_STYLE_INPUT, "Baits", "Enter below how much baits do you want.\n $%d per one","Purchase","Exit" ,BaitPrice);
    }
	return 1;
}
Now, when I do the command that performs the purchase, and I won't press anything but only the "ESC" to leave the dialog, its force me to buy the fishing rod.
Reply
#2

That's why there is "response" parameter. If response is 0, then the player either clicked on second button or pressed ESC. If you want the code to be executed only when a player clicked the first button or pressed Enter:
pawn Код:
Dialog:fishtools(playerid, response, listitem, inputtext[])
{
    if (response)
    {
        // code..
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
That's why there is "response" parameter. If response is 0, then the player either clicked on second button or pressed ESC. If you want the code to be executed only when a player clicked the first button or pressed Enter:
pawn Код:
Dialog:fishtools(playerid, response, listitem, inputtext[])
{
    if (response)
    {
        // code..
    }
    return 1;
}
Thanks mate, +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)