Player Dialog help please
#1

PHP код:
            case 3892:
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        new 
string[256];
                        
format(stringsizeof(string), "You have withdrawed $%s from your bank account"strlen(inputtext));
                        if(
Player[playerid][BankMoney] >= strlen(inputtext))
                        {
                            
Player[playerid][Money] += strlen(inputtext);
                            
Player[playerid][BankMoney] -= strlen(inputtext);
                            
SendClientMessage(playeridWHITEstring);
                        }
                        else
                        {
                            
SendClientMessage(playeridWHITE"You dont have that kind of money!");
                        }
                    }
                }
            } 
There is my code. When I type something in the text box that comes up and type something in, nothing happens.
Reply
#2

Try strval And this

GivePlayerMoney(playerid, Player[playerid][Money]);
Player[playerid][Money] = ( Player[playerid][Money] - strval( inputtext ) );
Player[playerid][BankMoney] = Player[playerid][BankMoney] - strval( inputtext ) );
Reply
#3

It still isnt working. This is what im doing:

PHP код:

            
case 3874:
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        
ShowPlayerDialog(playerid3892DIALOG_STYLE_INPUT"Withdraw""How much would you like to withdraw?""Withdraw""Cancel"); //withdraw
                    
}
                    case 
1:
                    {
                        
ShowPlayerDialog(playerid3893DIALOG_STYLE_INPUT"Deposit""How much would you like to deposit?""Deposit""Cancel"); //deposit
                    
}
                }
            }
            case 
3892:
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        new 
string[256];
                        
format(stringsizeof(string), "You have withdrawed $%s from your bank account"strlen(inputtext));
                        if(
Player[playerid][BankMoney] >= strlen(inputtext))
                        {
                            
GivePlayerMoneyplayeridstrvalinputtext ) );
                              
Player[playerid][Money] += strlen(inputtext);
                            
Player[playerid][BankMoney] = Player[playerid][BankMoney]-strval(inputtext);
                            
SendClientMessage(playeridWHITEstring);
                        }
                        else
                        {
                            
SendClientMessage(playeridWHITE"You dont have that kind of money!");
                        }
                    }
                }
            }
            case 
3893:
            {
                switch(
listitem)
                {
                    case 
0:
                    {
                        new 
string[256];
                        
format(stringsizeof(string), "You have deposited $%s to your bank account"strlen(inputtext));
                        if(
Player[playerid][Money] >= strlen(inputtext))
                        {
                            
Player[playerid][Money] -= strlen(inputtext);
                            
Player[playerid][BankMoney] += strlen(inputtext);
                            
SendClientMessage(playeridWHITEstring);
                        }
                        else
                        {
                            
SendClientMessage(playeridWHITE"You dont have that kind of money!");
                        }
                    }
                }
            } 
But to activate that, I used
PHP код:
ShowPlayerDialog(playerid3874DIALOG_STYLE_LIST"ATM""Withdraw\nDeposit\n""Select""Cancel"); 
The menu does load, but when i type something in into the input, nothing happens.
Reply
#4

Here Work Off Mine It works.. I dont use SwitchList Either or case: 0 I used If(response) and my Dialogs are Defined Easier for me to remember What im doing Hope it helps Just use What I have Change the PlayerInfo pbank Etc u can remove some of the Client Messages


pawn Код:
case DIALOG_BANKWITHDRAW: // when the dialog is DIALOG_BANKWITHDRAW (6)
        {
            if( response )
            {
                if( !IsNumeric( inputtext ) ) return SendClientMessage(playerid, RED, "Error Numbers Only "); // this will check if the inputtext contains numbers
                if( strval( inputtext ) > PlayerInfo[playerid][pBank] ) return SendClientMessage( playerid, RED, "You dont have that amount of money on your bank! " ), ShowPlayerDialog( playerid, DIALOG_BANKWITHDRAW, DIALOG_STYLE_INPUT, "Bank Withdraw", "Please enter the amount of money you want to withdraw.", "Ok", "Back" ); // if the inputtext is higher then you have on your bank, it will show an error message
                PlayerInfo[playerid][pBank] = ( PlayerInfo[playerid][pBank] - strval( inputtext ) ); // this will remove the money from your bank account
                GivePlayerMoney( playerid, strval( inputtext ) ); // this will add the money from the bank account to your own money
                new String[128];
                format( String, sizeof String, "You withdrew $%i from your bank, and now got $%i on your bank left. ", strval( inputtext ), PlayerInfo[playerid][pBank] ); // formatting amessage which shows the amount you withdrew, and the money you have left
                SendClientMessage( playerid, YELLOW, String ); // sending the message
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Apocalypse Bank N Trust", "Balance\nWithdraw\nDeposit", "Select", "Close" ); // showing the dialog again, so you dont have to do /bankhome
            }
            else if( !response )
            {
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Apocalypse Bank N Trust", "Balance\nWithdraw\nDeposit", "Select", "Close" ); // when you press the button 'Back', it will go to /bankhome
            }
        }
        case DIALOG_BANKDEPOSIT: // when the dialog is DIALOG_BANKDEPOSIT (7)
        {
            if( response )
            {
                if( !IsNumeric( inputtext ) ) return SendClientMessage(playerid, RED, "Numbers only! "); // this will check if the inputtext contains numbers

                if( GetPlayerMoney( playerid ) < strval( inputtext ) ) return SendClientMessage( playerid, RED, "You dont have that much money. "), ShowPlayerDialog( playerid, DIALOG_BANKDEPOSIT, DIALOG_STYLE_INPUT, "Bank Deposit", "Please enter the amoutn of money you want to deposit. ", "Ok", "Back" ); // if your money is lower as the amount you entered, it will give you an error message and show the same dialog
                PlayerInfo[playerid][pBank] = ( PlayerInfo[playerid][pBank] + strval( inputtext ) ); // adding the amount of money to your bank account
                GivePlayerMoney( playerid, - strval( inputtext) ); // removing the money from 'pocket'
                new String[128];
                format( String, sizeof String, "You Deposited $%i in your account, and now got $%i on your bank account. ", strval( inputtext ), PlayerInfo[playerid][pBank] ); // formatting the message which howmutch you depositted, and the amount you now got on your bank
                SendClientMessage( playerid, YELLOW, String ); // sending the message
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST,  "Apocalypse Bank N Trust", "Balance\nWithdraw\nDeposit", "Select", "Close" ); // showing /bankhome dialog again
            }
            else if( !response )
            {
                ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST,  "Apocalypse Bank N Trust", "Balance\nWithdraw\nDeposit", "Select", "Close" ); // when you press the button 'Back', it will go to /bankhome
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: