SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 22/01/2011, 10:50 AM   #1
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Default y_ini Help

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
        }
    }
Linus- is offline  
Old 22/01/2011, 10:51 AM   #2
Code_Red
Gangsta
 
Code_Red's Avatar
 
Join Date: Jul 2010
Location: LeChuck's secret fortress.
Posts: 717
Reputation: 123
Default Re: y_ini Help

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
__________________

Credit to Gortex!
Code_Red is offline  
Old 22/01/2011, 10:55 AM   #3
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Default Re: y_ini Help

Quote:
error 029: invalid expression, assumed zero
pls help
Linus- is offline  
Old 22/01/2011, 11:19 AM   #4
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Location: Islamabad, Pakistan
Posts: 1,341
Reputation: 66
Default Re: y_ini Help

You missed up '(' ')' somewhere?
__________________
HyperZ is offline  
Old 22/01/2011, 11:22 AM   #5
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Default Re: y_ini Help

No, pls help
Linus- is offline  
Old 22/01/2011, 11:45 AM   #6
Finn
High-roller
 
Join Date: Jan 2008
Posts: 1,464
Reputation: 382
Default Re: y_ini Help

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.
Finn is offline  
Old 22/01/2011, 01:09 PM   #7
Linus-
Big Clucker
 
Join Date: Nov 2010
Posts: 54
Reputation: 9
Default Re: y_ini Help

thank you. it is working.
Linus- is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Y_INI [HELP] park4bmx Help Archive 14 15/01/2011 03:18 PM
Y_ini help. Haydz Help Archive 0 12/01/2011 11:35 AM
Y_Ini. Zh3r0 Help Archive 1 15/10/2010 09:00 PM


All times are GMT. The time now is 03:52 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.