SA-MP Forums Archive
y_ini Help - 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: y_ini Help (/showthread.php?tid=214883)



y_ini Help - Linus- - 22.01.2011

Hi i have created that auto login system but getting some error
Error:
pawn Code:
error 033: array must be indexed (variable "tmp2")
pawn Code:
new
        PlayerFile[13 + MAX_PLAYER_NAME];
    if (!INI_Exist(pName(playerid)))
    {
        //register request
    }
    else
    {
        format(PlayerFile,256,"Accounts/%s.ini",Encode(pName(playerid)));
        new tmp[50],tmp2[256]; GetPlayerIp(playerid,tmp,50);
        tmp2 = INI_ParseFile(PlayerFile,"IP");// that is the line where getting error please help me.
        if(!strcmp(tmp,tmp2,true))
        {
            //auto login
        }
        else
        {
            //login request
        }
    }



Re: y_ini Help - Code_Red - 22.01.2011

Quote:
Originally Posted by Linus-
View Post
Hi i have created that auto login system but getting some error
Error:
pawn Code:
error 033: array must be indexed (variable "tmp2")
pawn Code:
new
        PlayerFile[13 + MAX_PLAYER_NAME];
    if (!INI_Exist(pName(playerid)))
    {
        //register request
    }
    else
    {
        format(PlayerFile,256,"Accounts/%s.ini",Encode(pName(playerid)));
        new tmp[50],tmp2[256]; GetPlayerIp(playerid,tmp,50);
        tmp2[] = INI_ParseFile(PlayerFile,"IP");// that is the line where getting error please help me.
        if(!strcmp(tmp,tmp2,true))
        {
            //auto login
        }
        else
        {
            //login request
        }
    }
4char


Re: y_ini Help - Linus- - 22.01.2011

Quote:

error 029: invalid expression, assumed zero

pls help


Re: y_ini Help - HyperZ - 22.01.2011

You missed up '(' ')' somewhere?


Re: y_ini Help - Linus- - 22.01.2011

No, pls help


Re: y_ini Help - Finn - 22.01.2011

Try this:

pawn Code:
new checkedIP[32];

forward checkIP(name[], value[]);
public checkIP(name[], value[])
{
    INI_String("IP", checkedIP, sizeof(checkedIP));
}
pawn Code:
new filename[13 + MAX_PLAYER_NAME];
format(filename, sizeof(filename), "Accounts/%s.ini", Encode(pName(playerid)));

if(!fexist(filename))
{
    //register request
}
else
{
    INI_ParseFile(filename, "checkIP");

    new IP[32];
    GetPlayerIp(playerid, IP, sizeof(IP));

    if(!strcmp(IP, checkedIP, true))
    {
        //auto login
    }
    else
    {
        //login request
    }
}
Edit: Changed the code once again.


Re: y_ini Help - Linus- - 22.01.2011

thank you. it is working.