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)
+--- Thread: error 033: array must be indexed .. (/showthread.php?tid=503064)



error 033: array must be indexed .. - Kyance - 27.03.2014

I've been trying to fix the Auto-Login script, but i always get the same error:
Код:
error 033: array must be indexed (variable "plrIP")
Code:
pawn Код:
new plrIP[16];
        GetPlayerIp(playerid, plrIP, sizeof(plrIP));
        if(PlayerInfo[playerid][pACBanned] == 0 && PlayerInfo[playerid][pBanned] == 0)
        {
            if(PlayerInfo[playerid][pIP] == plrIP) //This is the error line!
            {
                SendClientMessage(playerid, -1, "{FFFFFF}* {00C0FF}You've been Auto Logged-In by the server!");
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
                SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                PlayerInfo[playerid][pLoggedIn] = 1;
                SendClientMessage(playerid, -1, "{FFFFFF}* {00C0FF}Stats initialized successfully!");
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Type your password below to login.","Login","Quit");
            }
        }
I've been trying to do stuff like plrIP[playerid], plrIP[16], plrIP[playerid][16] etc., but i still get the error.

Any ideas of how to fix it?


Re: error 033: array must be indexed .. - Anzipane - 27.03.2014

You can't use the '==' operator on strings since they are complex data structures, you'll need to use the strcmp function.


Re: error 033: array must be indexed .. - Kyance - 27.03.2014

Thank you