SA-MP Forums Archive
error 029: invalid expression, assumed zero - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 029: invalid expression, assumed zero (/showthread.php?tid=362006)



error 029: invalid expression, assumed zero - maramizo - 23.07.2012

Getting an error on a working line, any ideas?
pawn Код:
CMD:hedit(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
        return 1;
    }

    new string[128], choice[32], houseid, amount;
    if(sscanf(params, "s[32]dD", choice, houseid, amount))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hedit [name] [houseid] [(Optional)amount]");
        if(PlayerInfo[playerid][pAdmin] < 99999)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Available names: CreateNext, CustomInterior, CustomExterior, Exterior(For only owned houses)");
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Available names: Interior, CustomInterior, CustomExterior,Exterior, Level, Price, CreateNext");
        }
        return 1;
    }
    else if(!strcmp(choice, "createnext", true)) // THIS LINE CONTAINS THE ERROR.
    {
        new cla,pri;
        if(sscanf(params,"s[11]dd","createnext",cla,pri)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit createnext [Class] [Price]");
        if(cla > 4 || cla < 1) return SendClientMessage(playerid, COLOR_WHITE, "Class ranges from 1 - 4");
        if(pri < 0) return SendClientMessage(playerid, COLOR_WHITE, "Price cannot be lower than 0");
        if(PlayerInfo[playerid][pAdmin] < 99999 && cla == 4) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to create a donator house.");
        for(new x;x<MAX_HOUSES;x++)
        {
            if(HouseInfo[x][hOwned] == 0)
            {
                CreateHouse(playerid, x, cla, pri);
                break;
            }
        }
    }
    return 1;
}
Errors :
Quote:

error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "if"

All on the same line.


Re: error 029: invalid expression, assumed zero - Kindred - 23.07.2012

Try to remove "else".

Why?

1) It's not needed, you aren't even using strcmp in the if statement before.

2) Like I said, not needed, if they didn't type in the needed parameters, it shows the code about, hence forth it will not continue on, so there is no need for an else statement.


Re: error 029: invalid expression, assumed zero - maramizo - 23.07.2012

Indeed but, why would else cause an error in the first place?