Loose indentation, what do i do?
#1

So, i've been having errors at the following lines:
pawn Код:
else
                            {
                                SendClientMessage(playerid, COLOR_RED, "An error occured getting the current house owners data.");
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
CMD:reloadhouses(playerid, params[])
{
And errors
Код:
-(1520) : warning 217: loose indentation
-(1520) : error 029: invalid expression, assumed zero
-(1520) : error 017: undefined symbol "cmd_reloadhouses"
-(1520) : error 029: invalid expression, assumed zero
-(1520) : error 029: invalid expression, ass-(1520) : fatal error 107: too many error messages on one line
Reply
#2

Loose indentation is when your identing (the huge spaces before letters) is incorrect.

I can fix it for you if you want, but I'd like your full code as I need to see how your code is opened.

Also; the error (cmd_etc isn't defined) can be fixed by getting the ZCMD include; as that include allows you to use the CMD:name format.
Reply
#3

Actually, he more likely has the ZCMD include, the reason it's appearing is probably because he hasn't closed the command above /reloadhouses properly.
Reply
#4

Well, heres the command, but i didnt fully include the whole code of it, as i spend a lot of time making it and don't want others to use it:
pawn Код:
CMD:buyhouse(playerid, params[])
{
    for(new hi = 0; hi < sizeof(HInfo); hi++)
    {
    if(IsPlayerInRangeOfPoint(playerid, 3, HInfo[hi][heX],HInfo[hi][heY],HInfo[hi][heZ]))
    {
        if(!strcmp(HInfo[hi][hOwnedBy], "None") || HInfo[hi][hForSale] == 1)
        {
            if(pInfo[playerid][Logged] == 0)
            {
                SendClientMessage(playerid, COLOR_RED, "You are not logged in!");
                return 1;
            }
            else //Can purchase it.
            {
                if(pInfo[playerid][pHouse1] > 0 && pInfo[playerid][pHouse2] > 0) { SendClientMessage(playerid, COLOR_RED, "You cannot have more than 2 houses!"); return 1; }
                if(pInfo[playerid][pHouse1] == 0)
                {
                    if(!strcmp(HInfo[hi][hOwnedBy], "None"))
                    {
                        if(HInfo[hi][hDefaultPrice] > pInfo[playerid][pMoney])
                        {
                            SendClientMessage(playerid, COLOR_RED, "You cannot afford to purchase this house!");
                            return 1;
                        }
                        return 1;
                    }
                    if(HInfo[hi][hPrice] > pInfo[playerid][pMoney])
                    {
                        SendClientMessage(playerid, COLOR_RED, "You cannot afford to purchase this house!");
                        return 1;
                    }
                    if(isonline == 1) //he is online
                    {
                        new CHECKNAME[MAX_PLAYER_NAME];
                        for(new i = 0; i<MAX_PLAYERS; i++)
                        {
                            GetPlayerName(i, CHECKNAME, MAX_PLAYER_NAME);
                            if(!strcmp(CHECKNAME, HInfo[hi][hOwnedBy]))
                            {
                                if(IsHouse1 == 0 && IsHouse2 == 0) //CANCEL HOUSE PURCHASE.
                                {
                                    SendClientMessage(playerid, COLOR_RED, "An unknown error occured while fetching house owners data.");
                                    return 1;
                                }
                                if(IsHouse1 == 1)
                                {
                                    return 1;
                                }
                                else if(IsHouse2 == 1)
                                {
                                    return 1;
                                }
                            }
                        }
                    }
                    else //he is offline
                    {
                        if(house1id == hi)
                        {
                            return 1;
                        }
                        else
                        {
                            if(house2id == hi)
                            {
                                return 1;
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_RED, "An error occured getting the current house owners data.");
                                return 1;
                            }
                        }
                    }
                }
                if(pInfo[playerid][pHouse2] == 0)
                {
                    if(!strcmp(HInfo[hi][hOwnedBy], "None"))
                    {
                        if(HInfo[hi][hDefaultPrice] > pInfo[playerid][pMoney])
                        {
                            SendClientMessage(playerid, COLOR_RED, "You cannot afford to purchase this house!");
                            return 1;
                        }
                        return 1;
                    }
                    if(HInfo[hi][hPrice] > pInfo[playerid][pMoney])
                    {
                        SendClientMessage(playerid, COLOR_RED, "You cannot afford to purchase this house!");
                        return 1;
                    }
                    {
                        {
                            {
                                {
                                    SendClientMessage(playerid, COLOR_RED, "An unknown error occured while fetching house owners data.");
                                    return 1;
                                }
                                if(IsHouse1 == 1)
                                {
                                    return 1;
                                }
                                else if(IsHouse2 == 1)
                                {
                                    return 1;
                                }
                            }
                        }
                    }
                    else //he is offline
                    {
                        if(house1id == hi)
                        {
                            return 1;
                        }
                        else
                        {
                            {
                                return 1;
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_RED, "An error occured getting the current house owners data.");
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
CMD:reloadhouses(playerid, params[])
{
    if(pInfo[playerid][pAdmin] >= 6)
    {
        for(new i=0;i<MAX_HOUSES;i++)
        {
            ReloadHouse(i);
        }
        SendClientMessage(playerid, COLOR_WHITE, "You have reloaded all houses.");
        AdminLog(playerid, "/reloadhouses", "Reloaded Houses", "Houses");
        return 1;
    }
    else
    {
        return 0;
    }
    return 1;
}
*I only removed the things inside the brackets and stuff, nothing else.*
Reply
#5

The for loop and the if(IsPlayerInRangeOfPoint) are on the same lines, my guess would be that that is the problem or either missed a bracket on either for loop or if statement.
Reply
#6

In the command /buyhouse, there are 41 opened brackets and 40 closed so you missed 1 closed bracket -> }

And what is that?
pawn Код:
...

                        if(HInfo[hi][hPrice] > pInfo[playerid][pMoney])
                        {
                            SendClientMessage(playerid, COLOR_RED, "You cannot afford to purchase this house!");
                            return 1;
                        }
                        {
                            {
                                {
                                    {
                                        SendClientMessage(playerid, COLOR_RED, "An unknown error occured while fetching house owners data.");
                                        return 1;
                                    }
                                    if(IsHouse1 == 1)
                                    {
                                        return 1;
                                    }
                                    else if(IsHouse2 == 1)
                                    {
                                        return 1;
                                    }
                                }
                            }
                        }
too many useless opened brackets
Reply
#7

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
In the command /buyhouse, there are 41 opened brackets and 40 closed so you missed 1 closed bracket -> }

And what is that?
pawn Код:
...

                        if(HInfo[hi][hPrice] > pInfo[playerid][pMoney])
                        {
                            SendClientMessage(playerid, COLOR_RED, "You cannot afford to purchase this house!");
                            return 1;
                        }
                        {
                            {
                                {
                                    {
                                        SendClientMessage(playerid, COLOR_RED, "An unknown error occured while fetching house owners data.");
                                        return 1;
                                    }
                                    if(IsHouse1 == 1)
                                    {
                                        return 1;
                                    }
                                    else if(IsHouse2 == 1)
                                    {
                                        return 1;
                                    }
                                }
                            }
                        }
too many useless opened brackets
As i said, i removed some of it as i don't want to show the whole script i spend ages on making.

EDIT: thanks, it worked.
Reply
#8

Way too many useless silly non-sense returns in that code, what a nightmare to try and debug.
Reply
#9

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Way too many useless silly non-sense returns in that code, what a nightmare to try and debug.
Can't you fucking read? Read other comments before posting a silly non-sense comment like that (;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)