bank help
#1

can someone help me with this bank code i just copied it from
https://sampforum.blast.hk/showthread.php?tid=284995

and here is the code
http://pastebin.com/1nh1QbUc
Reply
#2

someone help ?

i get these errors

Код:
C:\Users\Bojan\Desktop\testbank.pwn(161) : error 021: symbol already defined: "S@@_OnDialogResponse"
C:\Users\Bojan\Desktop\testbank.pwn(196) : error 021: symbol already defined: "S@@_OnDialogResponse"
C:\Users\Bojan\Desktop\testbank.pwn(230) : error 021: symbol already defined: "S@@_OnDialogResponse"
C:\Users\Bojan\Desktop\testbank.pwn(282) : error 021: symbol already defined: "S@@_OnDialogResponse"
C:\Users\Bojan\Desktop\testbank.pwn(334) : error 021: symbol already defined: "S@@_OnDialogResponse"
Reply
#3

You have two OnDialogResponse, fix it and your problem will be fixed.
Reply
#4

no i dont O.o
Reply
#5

Quote:
Originally Posted by Wonderweiss
Посмотреть сообщение
no i dont O.o
Line 280 and 332 on http://pastebin.com/1nh1QbUc.
Reply
#6

what should i do ?
Reply
#7

You've probably copied all codes from a tutorial. Use this:

Код:
    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
    {
            switch( dialogid ) // this will 'switch' through the dialogids, you can use if() aswell, but if im right its faster with switch()
            {
                case DIALOG_BANKHOME: // when the dialog is DIALOG_BANKHOME (5)
                {
                            if( response )
                            {
                                switch( listitem )
                                {
                                    case 0: // when you selected the first listitem ('Wealth check') and press the first button
                                    {
                                                    new Wealth[128];
                                                    format( Wealth, sizeof Wealth, "You have $%i on your bank account. ", PlayerInfo[playerid][BankWealth] ); // this will get the amount of money that is in your bank account
                                                    SendClientMessage(playerid, COLOR_YELLOW, Wealth); // this will send the message.. hm how is that possible o.O
                                        ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // Showing the dialog again, so you dotn have to do /bankhome again
                                        return 0;
                                    }
                                    case 1: // when you selected the listitem 'Withdraw money' and press the first button
                                    {
                                        ShowPlayerDialog( playerid, DIALOG_BANKWITHDRAW, DIALOG_STYLE_INPUT, "Bank Withdraw", "Please enter the amount of money you want to withdraw. ", "Ok", "Back" ); // showing a new dialog
                                    }
                                    case 2: // when you selected the listitem 'Deposit money' and press the first button
                                    {
                                        ShowPlayerDialog( playerid, DIALOG_BANKDEPOSIT, DIALOG_STYLE_INPUT, "Bank Deposit", "Please enter the amoutn of money you want to deposit. ", "Ok", "Back" ); // showing a new dialog
                                    }
                                }
                            }
     
                }
                case DIALOG_BANKWITHDRAW: // when the dialog is DIALOG_BANKWITHDRAW (6)
                {
                    if( response )
                    {
                                    if( !isnumeric( inputtext ) ) return SendClientMessage(playerid, COLOR_RED, "Numbers only! "); // this will check if the inputtext contains numbers
                                    if( strval( inputtext ) > PlayerInfo[playerid][BankWealth] ) return SendClientMessage( playerid, COLOR_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][BankWealth] = ( PlayerInfo[playerid][BankWealth] - 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][BankWealth] ); // formatting amessage which shows the amount you withdrew, and the money you have left
                                    SendClientMessage( playerid, COLOR_YELLOW, String ); // sending the message
                                    ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // showing the dialog again, so you dont have to do /bankhome
                            }
                    else if( !response )
                    {
                        ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // 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, COLOR_RED, "Numbers only! "); // this will check if the inputtext contains numbers
     
                                    if( GetPlayerMoney( playerid ) < strval( inputtext ) ) return SendClientMessage( playerid, COLOR_RED, "You dont have that amount of money on you. "), 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][BankWealth] = ( PlayerInfo[playerid][BankWealth] + 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 depositted $%i to your bank, and now got $%i on your bank. ", strval( inputtext ), PlayerInfo[playerid][BankWealth] ); // formatting the message which howmutch you depositted, and the amount you now got on your bank
                                    SendClientMessage( playerid, COLOR_YELLOW, String ); // sending the message
                                    ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // showing /bankhome dialog again
                            }
                    else if( !response )
                    {
                        ShowPlayerDialog( playerid, DIALOG_BANKHOME, DIALOG_STYLE_LIST, "Bank home", "Wealth check \nWithdraw money \nDeposit money", "Ok", "Leave" ); // when you press the button 'Back', it will go to /bankhome
                    }
                }
            }
            return 1;
    }
Delete all other OnDialogResponse's.
Reply
#8

FIXED VERSION
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)