Inputtext closing dialog box?
#1

For some reason, whenever I enter a number, the dialog box shuts. Help please?

pawn Код:
if(dialogid==6)
{
if(!response)return 0;
if(strval(inputtext) > PlayerInfo[playerid][pCash]) {
SendClientMessage(playerid, COLOR_RED, "You cannot deposit more money that you atcually have!");
}
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] - strval(inputtext);
AntiHack(playerid, -strval(inputtext));
PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] + strval(inputtext);
}
Reply
#2

pawn Код:
if(dialogid==6) {
if(response) {
if(strval(inputtext) > PlayerInfo[playerid][pCash]) SendClientMessage(playerid, COLOR_RED, "You cannot deposit more money that you atcually have!");
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] - strval(inputtext);
AntiHack(playerid, -strval(inputtext));
PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] + strval(inputtext);
SendClientMessage(playerid, COLOR_GREEN, "Success!");
}
}
Reply
#3

If you don't get a message, check your Dialog ID's

EDIT: Sorry for double post, meant to edit first one.
Reply
#4

Still didn't work, for some reason it just randomly closes when I enter the first number
Reply
#5

Yo boii's wouldnt mind some help
Reply
#6

pawn Код:
#define DBANKQ 2064
#define DBANKW 2065
#define DBANKD 2066
pawn Код:
if (dialogid == DBANKQ)
  {
    if (response == 1) // Withdraw
    {
      format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
      ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
    }
    else // Deposit
    {
      format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
      ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
    }
    }
  if (dialogid == DBANKD) // BANK / DEPOSIT
  {
    if (response == 1) // OK
    {
      if(IsNull(inputtext))
      {
        format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
        ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
        return 1;
            }
            if (strval(inputtext) > GetPlayerMoney(playerid) || strval(inputtext) < 1)
            {
              format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
        ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
                return 1;
            }
            SafeGivePlayerMoney(playerid, (0 - strval(inputtext)));
            PlayerInfo[playerid][pCash] -= strval(inputtext);
            PlayerInfo[playerid][pAccount]=strval(inputtext)+PlayerInfo[playerid][pAccount];
    }
    else // CANCEL
    {

    }
        return 1;
  }
  if (dialogid == DBANKW) // WITHDRAW
  {
    if (response == 1) // OK
    {
      if(IsNull(inputtext))
      {
        format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
            ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
        return 1;
            }
      if (strval(inputtext) > PlayerInfo[playerid][pAccount] || strval(inputtext) < 1)
            {
              format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
        ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
                return 1;
            }
            SafeGivePlayerMoney(playerid,strval(inputtext));
            PlayerInfo[playerid][pCash] += strval(inputtext);
            PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-strval(inputtext);
    }
    else // CANCEL
    {

    }
        return 1;
  }
pawn Код:
if(strcmp(cmd, "/withdraw", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(IsPlayerInRangeOfPoint(playerid, 50, -2158.8682,643.0779,1052.3750))
        {
                format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to withdraw from your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
        ShowPlayerDialog(playerid,DBANKW,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "  You are not at the Bank !");
          return 1;
            }
        }
        return 1;
    }
if(strcmp(cmd, "/bank", true) == 0 || strcmp(cmd, "/deposit", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        if(!IsPlayerInRangeOfPoint(playerid, 50, -2158.8682,643.0779,1052.3750))
        {
          SendClientMessage(playerid, COLOR_GREY, "  You are not at the Bank !");
          return 1;
        }
            format(string, sizeof(string), "You have $%d in your account, and $%d in your wallet.\n\nHow much do you want to deposit into your bank account:", PlayerInfo[playerid][pAccount],GetPlayerMoney(playerid));
      ShowPlayerDialog(playerid,DBANKD,DIALOG_STYLE_INPUT,"Q:RP - Bank Question",string,"Ok","Cancel");
            return 1;
        }
        return 1;
    }
Reply
#7

Wow, thanks
Reply
#8

Anytime.
Reply
#9

Its gotta be me.. it STILL closes after I enter the first number!
Reply
#10

Did you press "Deposit" or "Withdraw" or just pressed ENTER?
Reply
#11

I pressed Deposit, but when I enter any number into the inputtext slot thingy, it just closes and puts it in my bank.
Reply
#12

Isn't that the aim?
Reply
#13

First number it auto-closes, It doesn't let me get past 1 number in the box
Reply
#14

I'd like to add that its only on numbers, not letters.
Reply
#15

Bump
Reply
#16

It closes without you pressing any buttons?
Reply
#17

Yes, I simply enter a number and it closes.
Reply
#18

Код:
ShowPlayerDialog(playerid,123321,DIALOG_STYLE_INPUT,"Deposit","Please Enter The Number You Want To Desposit","Done","Cancel");
Код:
if(dialogid == 123321)
{
if(!response) return 1;
if(response)
{
if(strval(inputtext) > PlayerInfo[playerid][pCash]) {
SendClientMessage(playerid, COLOR_RED, "You cannot deposit more money that you atcually have!");
}
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash] - strval(inputtext);
AntiHack(playerid, -strval(inputtext));
PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount] + strval(inputtext);
}
}
Reply
#19

I noticed that your dialog id is 123321, why is it so high?

And, are you sure this works?
Reply
#20

1.u can use any number for dialog even if 999999999999999999999999 i just make it high so i make sure it doesn't conflict with another dialog

2.i am sure it will work cause that's the way i made my EBank system in my signature
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)