Transfer System in Dialog Help.
#1

Hello, I've made a bank system using dialogs, and the only thing I need to top it off is a wire transfer system. Now, my question is that is it possible for inputtext to be equivalent to a playerid? I am trying to make it so that if they select Wire Transfer in the bank menu, then an inputtext dialog comes up where it informs you to input the playerid. Once you put in the playerid, it shows you another input dialog where you put the amount, now once I get to this point I have absolutely no idea how to make the transaction. This is my code so far. Any help would be appreciated.


pawn Код:
case DIALOG_TRANSFER:
        {
            new string[124],reciever = strval(inputtext);
            format(string,sizeof(string),"Balance: $%d\r\nWithdraw\r\nDeposit\r\nWire Transfer",pInfo[playerid][pBank]);
            if(!response)
            {
                return ShowPlayerDialog(playerid,DIALOG_BANK,DIALOG_STYLE_LIST,"{00B000}San Fierro City Bank",string,"Accept","Cancel");
            }
            new tamount = strval(inputtext);
            if(response)
            {
                if(IsWiring[playerid] == 0)
                {
                    if(strval(inputtext) == INVALID_PLAYER_ID || reciever == playerid)
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRANSFER,DIALOG_STYLE_INPUT,"{00B000}Wire Transfer","{C60000}Error: Invalid Bank ID","Proceed","Back");
                        return 1;
                    }
                    if(!strval(inputtext))
                    {
                        return ShowPlayerDialog(playerid,DIALOG_TRANSFER,DIALOG_STYLE_INPUT,"{00B000}Wire Transfer","{C60000}Error: Invalid Bank ID","Proceed","Back");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid,DIALOG_TRANSFER,DIALOG_STYLE_INPUT,"{00B000}Wire Transfer","Type the amount that you want to transfer.","Transfer","Cancel");
                        IsWiring[playerid] = 1;
                        return 1;
                    }
                }
                else
                {
                    if(IsWiring[playerid] == 1)
                    {
                        if(!strval(inputtext))
                        {
                            return ShowPlayerDialog(playerid,DIALOG_TRANSFER,DIALOG_STYLE_INPUT,"{00B000}Wire Transfer","{C60000}Error: Invalid Transaction","Transfer","Cancel");
                        }
                        if(tamount > pInfo[playerid][pBank])
                        {
                            return ShowPlayerDialog(playerid,DIALOG_TRANSFER,DIALOG_STYLE_INPUT,"{00B000}Wire Transfer","{C60000}Error: Insufficient Funds","Transfer","Cancel");
                        }
                        else
                        {

                            pInfo[playerid][pBank] -= tamount;
                            pInfo[reciever][pBank] += tamount;
                            new tastr[124],st2[124];
                            format(tastr,sizeof(tastr),"%s has transferred $%d into your account.",GetName(playerid),tamount);
                            format(st2,sizeof(st2),"You have transferred $%d into %s's account.",tamount,GetName(reciever));
                            SendClientMessage(reciever,0xFFACACACFF,tastr);
                            SendClientMessage(playerid,0xFFACACACFF,st2);
                            IsWiring[playerid] = 0;
                            return 1;
                        }
                    }
                }
            }
Reply
#2

This......
pawn Код:
Isplayerconnented(inputtext)
{
//show next dialog.....
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)