SA-MP Forums Archive
error 033: array must be indexed - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: error 033: array must be indexed (/showthread.php?tid=241241)



error 033: array must be indexed - jamesbond007 - 17.03.2011

error 033: array must be indexed (variable "dini_Get")

pawn Код:
dcmd_login(playerid, params[])
{
    new name[MAX_PLAYER_NAME], file[200];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "\\users\\%s.ini", name);
    if(Logged[playerid] == 1) return SendClientMessage(playerid, COLOUR_RED, "You are already logged in!");
    if(!dini_Exists(file)) return SendClientMessage(playerid, COLOUR_RED, "This name isn't registered! Please register now!");
    else if(strlen(params) == 0) return SendClientMessage(playerid, COLOUR_RED, "You must enter a password to login!");
    else if(params[0] != dini_Get(file, "password")) return SendClientMessage(playerid, COLOUR_RED, "Login failed!");//THIS LINE
    else
    {
        SetPlayerMoney(playerid, dini_Int(file, "cash"));
        SetPlayerScore(playerid, dini_Int(file, "score"));
        Logged[playerid] = 1;
        SendClientMessage(playerid, COLOUR_YELLOW, "You are now logged in, and your stats were automaticly loaded!");
    }
    return 1;
}



Re: error 033: array must be indexed - Jochemd - 17.03.2011

Dini_Get returns a full string which you are trying to compare with 1 sign. Use strcmp to check the full string instead.


Re: error 033: array must be indexed - jamesbond007 - 17.03.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Dini_Get returns a full string which you are trying to compare with 1 sign. Use strcmp to check the full string instead.
ty vm man ! +1 rep


Re: error 033: array must be indexed - Jochemd - 17.03.2011

It's no problem :P