Having an error in bank
#1

Код:
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(35) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(41) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(42) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(45) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(56) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(54) : warning 204: symbol is assigned a value that is never used: "pincode"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(82) : warning 204: symbol is assigned a value that is never used: "pincode"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(82 -- 94) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(100) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(104) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(107) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(107) : error 029: invalid expression, assumed zero
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(107) : error 004: function "OnDialogResponse" is not implemented
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(109) : error 017: undefined symbol "dialogid"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(111) : error 017: undefined symbol "listitem"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(116) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(151) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(154) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(165) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Icons.pwn(201) : error 030: compound statement not closed at the end of file (started at line 40)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors..
Having these errors in this script, which i edited
Код:
#include <a_samp>
#include <Dini>
#include <dudb>
new pname[MAX_PLAYER_NAME];
new banklogged[MAX_PLAYERS];
new bankmoney[MAX_PLAYERS];
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x00FF00AA
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
         CreatePickup(1239, 23, 1458.6437,-1011.8918,26.8438, -1);
        print("/////////////////////////////////////////");
        print("//         SIMPLE BANK SYSTEM BY SEAN5874   //");
        print("//    Releasedate: 04-04-10           //");
        print("///////////////////////////////////////");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#endif

public OnPlayerDisconnect(playerid, reason)
{
    dini_IntSet(udb_encode(pname), "bankmoney", bankmoney[playerid]);
        return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], idx, tmp[265], tmp2[256];
        cmd = strtok(cmdtext, idx);
    GetPlayerName(playerid, pname, sizeof(pname));
    new string[128];
    //register and login stuff
        if (strcmp("/createaccount", cmdtext, true, 10) == 0)
        {
                new pincode; //creating the variable
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) //checks of the player dont forgot any variable
                {
                        SendClientMessage(playerid, COLOR_RED, "USAGE: /createaccount [pincode]");
                        return 1;
                }
                pincode = strval(tmp); //'pincode' got saved in an TMP

        if (!dini_Exists(udb_encode(pname))) //checks of the player have already made an account
        {
                dini_Create(udb_encode(pname));
                dini_IntSet(udb_encode(pname), "pincode", udb_hash(tmp)); //puts the pincode in the file
                dini_IntSet(udb_encode(pname), "bankmoney", 0); // if you want to give the player a starters bonus, then add here an other number
                SendClientMessage(playerid, COLOR_GREEN,"You have created new bank account! You can now log in.");
                return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED,"You have already a bank account!"); //if the player have already an bankaccount
                    return 1;
                }}
        if (strcmp("/loginaccount", cmdtext, true, 10) == 0)
        {
                new pincode; //creating the variable
                tmp = strtok(cmdtext, idx);
                if(banklogged[playerid] == 1) //checks if a player is logged in in his account
                {
                SendClientMessage(playerid, COLOR_RED, "You are already logged in!"); return 1;
                }
                if(!strlen(tmp)) //checks of the player dont forgot any variable
                {
                        SendClientMessage(playerid, COLOR_RED, "USAGE: /loginaccount [pincode]");
                        return 1;
                }
                pincode = strval(tmp); //'pincode' got saved in an TMP
                tmp2 = dini_Get(udb_encode(pname), "pincode"); //gets the pincode that is given by creating the account
                if (udb_hash(tmp) != strval(tmp2)) //looks of the given pincode match with the pincode in the file
                {
                        SendClientMessage(playerid, COLOR_RED, "You have entered a wrong pincode, try again!"); //if not...
                        return 1;
                }
                SendClientMessage(playerid, COLOR_GREEN, "You have logged in into your bankaccount!");//if yes...
                banklogged[playerid] = 1;
                return 1;
        }

       if(strcmp(cmd,"/bank",true)==0)
        {
        if(banklogged[playerid] == 0) // checks if a player is logged in in his account
                {
                SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
			   }
			   else if(banklogged[playerid] == 1) // checks of the player dont forgot any variable
                {
                ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Bank","Withdraw\n Transfer\n Balance","Select","Exit");
                }
                return 1;
                }

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid==1 && response==1)
{

    switch(listitem)
    {
        case 0:
        {
        new wamount; //creating the variable
                tmp = strtok(cmdtext, idx);
                if(banklogged[playerid] == 0) // checks if a player is logged in in his account
                {
                SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
                }
                if(!strlen(tmp)) // checks of the player dont forgot any variable
                {
                SendClientMessage(playerid, COLOR_RED, "USAGE: /withdraw [amount]"); return 1;
                }
                wamount = strval(tmp); //'wamount' got saved in an TMP

                new bank = bankmoney[playerid];
                if(bank <= wamount) // if a player tries to withdraw more money than he haves on his account...
                {
                        SendClientMessage(playerid, COLOR_RED,"You can't withdraw more money than you have!"); return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 1.0, 1458.6437,-1011.8918,26.8438))// check if the player is at the bank
                {
                        bankmoney[playerid] -= wamount; //money is taken from the bank account
                        format(string, sizeof(string), "You have withdrawed $%d to your bank account.",wamount); // show the amount of withdrawed money
                        SendClientMessage(playerid, COLOR_YELLOW, string);
                        GivePlayerMoney(playerid, wamount);// gives the player his money
                        return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED,"You are not at the Bank!"); return 1; //if hes not at the bank
                }
        }
		case 1:
		{
		 if(banklogged[playerid] == 0) //checks if a player is logged in in his account
                {
                SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 1.0, 1458.6437,-1011.8918,26.8438)) //check if the player is at the bank
                {
                format(string, sizeof(string), "You have currently $%d in your bank account.",bankmoney[playerid]); //show the amount of money on the account
                        SendClientMessage(playerid, COLOR_YELLOW, string);
                        return 1;
                }
                else
                {
                SendClientMessage(playerid, COLOR_RED,"You are not at the Bank!"); return 1; //if hes not at the bank
                }
        }
        case 2:
        {
        new amount; //creating the variable
                tmp = strtok(cmdtext, idx);
                if(banklogged[playerid] == 0) //checks if a player is logged in in his account
                {
                SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
                }
                if(!strlen(tmp)) // checks of the player dont forgot any variable
                {
                        SendClientMessage(playerid, COLOR_RED, "USAGE: /deposit [amount]"); return 1;
                }
                amount = strval(tmp); //'amount' got saved in an TMP

                new currentm = GetPlayerMoney(playerid);
                if(currentm <= amount) //checks if the players current money is lower than the amount he want to deposit
                {
                        SendClientMessage(playerid, COLOR_RED,"You can't deposit more money than you have!"); return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 1.0, 1458.6437,-1011.8918,26.8438))// checks if the player at the bank
                {
                        bankmoney[playerid] += amount; //money goes on the bank account
                        format(string, sizeof(string), "You have deposited $%d to your bank account.",amount);
                        SendClientMessage(playerid, COLOR_YELLOW, string);
                        GivePlayerMoney(playerid, -amount);
                        return 1;
                }
                else
                {
                        SendClientMessage(playerid, COLOR_RED,"You are not at the Bank!"); return 1; // if hes not at the bank...
                }
        }
        }
        }
	return 1;
}
Help me with it please.
Reply
#2

Fix your indentation

pawn Код:
if(strcmp(cmd,"/bank",true)==0)
    {
        if(banklogged[playerid] == 0) // checks if a player is logged in in his account
        {
            SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
        }
        if(!strlen(tmp)) // checks of the player dont forgot any variable
        {
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Bank","Withdraw\n Transfer\n Balance","Select","Exit");
        }
    //   <------------   something missing here
    return 1;
}
Reply
#3

There is no text missing, Help me with these errors pls?
Reply
#4

Quote:
Originally Posted by RyanPetersons
Посмотреть сообщение
There is no text missing, Help me with these errors pls?
There is a bracket ( '}' ) missing.
Reply
#5

I added there a bracket but 8 errors then.
Reply
#6

Quote:
Originally Posted by RyanPetersons
Посмотреть сообщение
I added there a bracket but 8 errors then.
What errors?
Reply
#7

pawn Код:
#include <a_samp>
#include <Dini>
#include <dudb>
new pname[MAX_PLAYER_NAME];
new banklogged[MAX_PLAYERS];
new bankmoney[MAX_PLAYERS];
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x00FF00AA
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
         CreatePickup(1239, 23, 1458.6437,-1011.8918,26.8438, -1);
        print("/////////////////////////////////////////");
        print("//         SIMPLE BANK SYSTEM BY SEAN5874   //");
        print("//    Releasedate: 04-04-10           //");
        print("///////////////////////////////////////");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#endif

public OnPlayerDisconnect(playerid, reason)
{
    dini_IntSet(udb_encode(pname), "bankmoney", bankmoney[playerid]);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256], idx, tmp[265], tmp2[256];
    cmd = strtok(cmdtext, idx);
    GetPlayerName(playerid, pname, sizeof(pname));
    //register and login stuff
    if (strcmp("/createaccount", cmdtext, true, 10) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) //checks of the player dont forgot any variable
        {
            SendClientMessage(playerid, COLOR_RED, "USAGE: /createaccount [pincode]");
            return 1;
        }
        if (!dini_Exists(udb_encode(pname))) //checks of the player have already made an account
        {
            dini_Create(udb_encode(pname));
            dini_IntSet(udb_encode(pname), "pincode", udb_hash(tmp)); //puts the pincode in the file
            dini_IntSet(udb_encode(pname), "bankmoney", 0); // if you want to give the player a starters bonus, then add here an other number
            SendClientMessage(playerid, COLOR_GREEN,"You have created new bank account! You can now log in.");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED,"You have already a bank account!"); //if the player have already an bankaccount
            return 1;
        }
    }
    if (strcmp("/loginaccount", cmdtext, true, 10) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(banklogged[playerid] == 1) //checks if a player is logged in in his account
        {
            SendClientMessage(playerid, COLOR_RED, "You are already logged in!"); return 1;
        }
        if(!strlen(tmp)) //checks of the player dont forgot any variable
        {
            SendClientMessage(playerid, COLOR_RED, "USAGE: /loginaccount [pincode]");
            return 1;
        }
        tmp2 = dini_Get(udb_encode(pname), "pincode"); //gets the pincode that is given by creating the account
        if (udb_hash(tmp) != strval(tmp2)) //looks of the given pincode match with the pincode in the file
        {
            SendClientMessage(playerid, COLOR_RED, "You have entered a wrong pincode, try again!"); //if not...
            return 1;
        }
        SendClientMessage(playerid, COLOR_GREEN, "You have logged in into your bankaccount!");//if yes...
        banklogged[playerid] = 1;
        return 1;
    }
    if(strcmp(cmd,"/bank",true)==0)
    {
        if(banklogged[playerid] == 0) // checks if a player is logged in in his account
        {
            SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
        }
        if(!strlen(tmp)) // checks of the player dont forgot any variable
        {
            ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Bank","Withdraw\n Transfer\n Balance","Select","Exit");
        }
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new cmdtext[256];
    new tmp[256];
    new string[128];
    new idx;
   
    if(dialogid==1 && response==1)
    {
        switch(listitem)
        {
            case 0:
            {
                new wamount; //creating the variable
                tmp = strtok(cmdtext, idx);
                if(banklogged[playerid] == 0) // checks if a player is logged in in his account
                {
                    SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
                }
                if(!strlen(tmp)) // checks of the player dont forgot any variable
                {
                    SendClientMessage(playerid, COLOR_RED, "USAGE: /withdraw [amount]"); return 1;
                }
                wamount = strval(tmp); //'wamount' got saved in an TMP

                new bank = bankmoney[playerid];
                if(bank <= wamount) // if a player tries to withdraw more money than he haves on his account...
                {
                    SendClientMessage(playerid, COLOR_RED,"You can't withdraw more money than you have!"); return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 1.0, 1458.6437,-1011.8918,26.8438))// check if the player is at the bank
                {
                    bankmoney[playerid] -= wamount; //money is taken from the bank account
                    format(string, sizeof(string), "You have withdrawed $%d to your bank account.",wamount); // show the amount of withdrawed money
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    GivePlayerMoney(playerid, wamount);// gives the player his money
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED,"You are not at the Bank!"); return 1; //if hes not at the bank
                }
            }
            case 1:
            {
                if(banklogged[playerid] == 0) //checks if a player is logged in in his account
                {
                    SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 1.0, 1458.6437,-1011.8918,26.8438)) //check if the player is at the bank
                {
                    format(string, sizeof(string), "You have currently $%d in your bank account.",bankmoney[playerid]); //show the amount of money on the account
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED,"You are not at the Bank!"); return 1; //if hes not at the bank
                }
            }
            case 2:
            {
                new amount; //creating the variable
                tmp = strtok(cmdtext, idx);
                if(banklogged[playerid] == 0) //checks if a player is logged in in his account
                {
                    SendClientMessage(playerid, COLOR_RED, "You are not logged in on your bank account!"); return 1;
                }
                if(!strlen(tmp)) // checks of the player dont forgot any variable
                {
                      SendClientMessage(playerid, COLOR_RED, "USAGE: /deposit [amount]"); return 1;
                }
                amount = strval(tmp); //'amount' got saved in an TMP

                new currentm = GetPlayerMoney(playerid);
                if(currentm <= amount) //checks if the players current money is lower than the amount he want to deposit
                {
                      SendClientMessage(playerid, COLOR_RED,"You can't deposit more money than you have!"); return 1;
                }
                if(IsPlayerInRangeOfPoint(playerid, 1.0, 1458.6437,-1011.8918,26.8438))// checks if the player at the bank
                {
                    bankmoney[playerid] += amount; //money goes on the bank account
                    format(string, sizeof(string), "You have deposited $%d to your bank account.",amount);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    GivePlayerMoney(playerid, -amount);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED,"You are not at the Bank!"); return 1; // if hes not at the bank...
                }
            }
        }
    }
    return 1;
}


//*-------------
Reply
#8

C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(32) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(3 : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(39) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(42) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(53) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(51) : warning 204: symbol is assigned a value that is never used: "pincode"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(79) : warning 204: symbol is assigned a value that is never used: "pincode"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(79 -- 91) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(102) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(40) : warning 204: symbol is assigned a value that is never used: "string"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(115) : warning 217: loose indentation
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(115) : error 017: undefined symbol "tmp"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(115) : error 017: undefined symbol "cmdtext"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(120) : error 017: undefined symbol "tmp"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(124) : error 017: undefined symbol "tmp"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(134) : error 017: undefined symbol "string"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(134) : error 017: undefined symbol "string"
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(134) : error 029: invalid expression, assumed zero
C:\DOCUME~1\MOSTWA~1\Desktop\SAMP03~1\FILTER~1\Ico ns.pwn(134) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#9

Try mine,i fixed the warning and errors.
Reply
#10

yeh, you fixed, there is no error but when i type /bank, there comes the dialog and i click then withdraw,deposit balance etc. then the dialog doesn't works
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)