[ERROR] error 029: invalid expression, assumed zero
#1

Hey, im derping on this part of my script. I have no idea how to deal with this, i've searched for countless threads, i still don't know how to fix this.

Quote:

gamemodes\test.pwn(437) : warning 217: loose indentation
gamemodes\test.pwn(437) : error 029: invalid expression, assumed zero

pawn Код:
if(strcmp(params,pass,false) != 0)
                        {
                                SendClientMessage(playerid,0xFF4500AA,"Wrong Password!");
                        }
                        else
                        {
                            dini_IntSet(file,"Logged",1);
                            pInfo[playerid][Logged] = 1;
                            pInfo[playerid][Level] = dini_Int(file,"Level");
                            SendClientMessage(playerid,0xFF4500AA,"You have now logged in!");
                            return 1;
                        }
                }
        }
        else // Line 437  receiving the error message, and indentation warning
        {
            SendClientMessage(playerid,0xFF0000AA,"USAGE: /login <Password>");
            return 1;
        }
  }
Reply
#2

Post the whole code for the command.
Reply
#3

pawn Код:
CMD:login(playerid, params[])
{
    new file[256], pname[MAX_PLAYER_NAME], pass[256];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(file, sizeof(file), "MyAdmin/Users/%s.txt", pname);
    if(!dini_Exists(file)) return SendClientMessage(playerid,0xFF0000AA,"You are not registered! Please /register");
    if(pInfo[playerid][Logged] == 1) return SendClientMessage(playerid,0xFF0000AA, "You are already logged in.");
    if(pInfo[playerid][Regged] == 0) return SendClientMessage(playerid,0xFF0000AA,"You are not registered! Please /register");
    if(sscanf(params, "ui", pass)) return SendClientMessage(playerid,0xFF0000AA,"Usage: /login <password>");
    {
            pass = dini_Get(file,"Password");
            if(dini_Exists(file))
            {
                if(strcmp(params,pass,false) != 0)
                        {
                                SendClientMessage(playerid,0xFF4500AA,"Wrong Password!");
                        }
                        else
                        {
                            dini_IntSet(file,"Logged",1);
                            pInfo[playerid][Logged] = 1;
                            pInfo[playerid][Level] = dini_Int(file,"Level");
                            SendClientMessage(playerid,0xFF4500AA,"You have now logged in!");
                            return 1;
                        }
                }
        }
        else
        {
            SendClientMessage(playerid,0xFF0000AA,"USAGE: /login <Password>");
            return 1;
        }
  }
Reply
#4

Have you used else if to see if that worked? And also fix up your indentation beginning at line 423.
Reply
#5

How should i use else if in this occasion?
Reply
#6

Sorry to bump, i still haven't found a way to fix it :/
Reply
#7

Just remove the else-statement and the brace under "if(sscanf"
You're doing the if check, and you're returning a function. If you were to use else, you would have to put it right beneath the if(sscanf line, but you haven't.

pawn Код:
CMD:login(playerid, params[])
{
    new file[256], pname[MAX_PLAYER_NAME], pass[256];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(file, sizeof(file), "MyAdmin/Users/%s.txt", pname);
    if(!dini_Exists(file)) return SendClientMessage(playerid,0xFF0000AA,"You are not registered! Please /register");
    if(pInfo[playerid][Logged] == 1) return SendClientMessage(playerid,0xFF0000AA, "You are already logged in.");
    if(pInfo[playerid][Regged] == 0) return SendClientMessage(playerid,0xFF0000AA,"You are not registered! Please /register");
    if(sscanf(params, "ui", pass))
        return SendClientMessage(playerid,0xFF0000AA,"Usage: /login <password>");

    pass = dini_Get(file,"Password");
    if(dini_Exists(file))
    {
        if(strcmp(params,pass,false) != 0)
            return SendClientMessage(playerid,0xFF4500AA,"Wrong Password!");

        dini_IntSet(file,"Logged",1);
        pInfo[playerid][Logged] = 1;
        pInfo[playerid][Level] = dini_Int(file,"Level");
        SendClientMessage(playerid,0xFF4500AA,"You have now logged in!");
    }
    return 1;
}
Reply
#8

It works! thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)