Bank system error
#1

Hello i made a bank system and i have those following errors

my code:
pawn Код:
switch( dialogid )
    {
                case DIALOG_BANK:
                {
                        if(!response) return 0;
                        if(response)
                        {
                                if(listitem == 0)
                                {
                                   new str[128];
                                   format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",pInfo[playerid][pBank]);
                                   ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back");
                                }
                                if(listitem == 1)
                                {
                                   new str[128];
                                   format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",pInfo[playerid][pBank]);
                                   ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back");
                                }
                                if(listitem == 2)
                                {
                                   new str[128];
                                   format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :",pInfo[playerid][pBank]);
                                   ShowPlayerDialog(playerid,DIALOG_TRANSFER1,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back");
                                }
                                if(listitem == 3)
                                {
                                   new str[128];
                                   format(str, sizeof(str), "Your current bank balance is: $%d", pInfo[playerid][pBank]);
                                   ShowPlayerDialog(playerid, DIALOG_BALANCE, DIALOG_STYLE_MSGBOX, "Bank account", str, "Back", "");
                                }
                        }
                }
                case DIALOG_DEPOSIT:
                {
                        if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
                        else if(strval(inputtext) > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount!");
                        else if(!IsNumeric(inputtext))
                        {
                                new str[128];
                                format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Deposit Below :",pInfo[playerid][pBank]);
                                ShowPlayerDialog(playerid, DIALOG_DEPOSIT, DIALOG_STYLE_INPUT, "Deposit",str, "Deposit", "Back");
                                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
                        }
                        else
                        {
                                new str[128];
                                new inputext = strval(inputtext);
                                pInfo[playerid][pBank] += inputext;
                                pInfo[playerid][Money] -= inputext;
                                format(str, sizeof(str), "You have deposited $%d into your account. New balance: $%d", inputext, pInfo[playerid][pBank]);
                                SendClientMessage(playerid, 0x008000FF, str);
                        }
                }
                case DIALOG_WITHDRAW:
                {
                        if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
                        else if(strval(inputtext) > pInfo[playerid][pBank]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount in your bank");
                        else if(!IsNumeric(inputtext))
                        {
                                new str[128];
                                format(str,sizeof(str),"Your Curret Balance Is : $%d\nEnter The Amount You Want To Withdraw Below :",pInfo[playerid][pBank]);
                                ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Withdraw",str, "Withdraw", "Back");
                                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
                        }
                        else
                        {
                                new str[128];
                                new inputext = strval(inputtext);
                                pInfo[playerid][pBank] -= inputext;
                                pInfo[playerid][Money] += inputext;
                                format(str, sizeof(str), "You have withdrawn $%d out of your account. New balance: $%d", inputext, pInfo[playerid][pBank]);
                                SendClientMessage(playerid, 0x008000FF, str);
                        }
                }
                case DIALOG_TRANSFER1:
                {
                        if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
                        else if(strval(inputtext) == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"Player Not Online");
                        else if(!IsNumeric(inputtext))
                        {
                                new str[128];
                                format(str,sizeof(str),"Your Current Balance Is : $%d\nEnter The Player ID You Want To Transfer To Below :", pInfo[playerid][pBank]);
                                ShowPlayerDialog(playerid,1130,DIALOG_STYLE_INPUT,"Transfer",str,"Next","Back");
                                SendClientMessage(playerid,COLOR_RED,"Please Use ID Not Name");
                        }
                        else
                        {
                                chosenpid = strval(inputtext);
                                new str[128];
                                format(str,sizeof(str),"Balance : %d\nChosen Player ID : %d\nNow Enter The Amount You Want To Transfer",pInfo[playerid][pBank],chosenpid);
                                ShowPlayerDialog(playerid,DIALOG_TRANSFER2,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back");
                        }
                }
                case DIALOG_TRANSFER2:
                {
                        if(!response) return ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");
                        else if(strval(inputtext) > PlayerInfo[playerid][pBank]) return SendClientMessage(playerid,COLOR_RED,"You Don't Have That Amount In Bank To Transfer");
                        else if(!IsNumeric(inputtext))
                        {
                                new str[128];
                                format(str,sizeof(str),"Chosen Player ID : %d\nNow Enter The Amount You Want To Transfer",chosenpid);
                                ShowPlayerDialog(playerid,1131,DIALOG_STYLE_INPUT,"Transfer",str,"Transfer","Back");
                                SendClientMessage(playerid,COLOR_RED,"Please Use Numbers");
                        }
                        else
                        {
                                pInfo[playerid][pBank] -= strval(inputtext);
                                pInfo[chosenpid][pBank] += strval(inputtext);
                                new str[128];
                                format(str,sizeof(str),"You Transfered $%d To ID %d's Bank Account",strval(inputtext),chosenpid);
                                SendClientMessage(playerid, 0x008000FF, str);
                                new str2[128];
                                format(str2,128,"Your New Balance Is : $%d",PlayerInfo[playerid][pBank]);
                                SendClientMessage(playerid,0x008000FF,str2);
                                new str3[128];
                                format(str3,128,"ID : %d Transfered $%d To Your Bank Account",playerid,strval(inputtext));
                                SendClientMessage(chosenpid,0x008000FF,str3);
                                new str4[128];
                                format(str4, 128, "Your New Balance : $%d", PlayerInfo[chosenpid][pBank]);
                                SendClientMessage(chosenpid, 0x008000FF, str4);
                                ShowPlayerDialog(playerid,1125,DIALOG_STYLE_LIST,"Bank","Deposit\nWithdraw\nBalance\nTransfer","Select","Cancel");
                        }
                }
                case DIALOG_BALANCE:
                {
                        if(response)
                        {
                                ShowPlayerDialog(playerid, DIALOG_BANK, DIALOG_STYLE_LIST, "{007A00}Bank account", " Deposit \n Withdraw \n Balance", "Select", "Cancel");

                        }
                }

    }
Errors:
Код:
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2414) : error 017: undefined symbol "IsNumeric"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2435) : error 017: undefined symbol "IsNumeric"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2456) : error 017: undefined symbol "IsNumeric"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2465) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2467) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2475) : error 017: undefined symbol "IsNumeric"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2478) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2485) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2487) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2494) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2496) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2497) : error 017: undefined symbol "chosenpid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


12 Errors.
Reply
#2

The errors are coming because you have no "IsNumeric" stock in your script.
Add this anywhere in your script:
pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Good luck!
Reply
#3

But i still have those errors:

Код:
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2465) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2467) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2478) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2485) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2487) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2494) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2496) : error 017: undefined symbol "chosenpid"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(2497) : error 017: undefined symbol "chosenpid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
and thanks for helping
Reply
#4

Add this to the top of your script, under #include <a_samp> and before main()

pawn Код:
new chosenpid;
Reply
#5

Thanks both +Reped
after 24 Hours -.-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)