22.07.2013, 14:55
(
Последний раз редактировалось Prostilov; 22.07.2013 в 15:44.
)
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?
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!");
}
}

