y_ini Help
#1

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
        }
    }
Reply
#2

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
Reply
#3

Quote:

error 029: invalid expression, assumed zero

pls help
Reply
#4

You missed up '(' ')' somewhere?
Reply
#5

No, pls help
Reply
#6

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.
Reply
#7

thank you. it is working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)