SA-MP Forums Archive
Y_ini , questions - 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: Y_ini , questions (/showthread.php?tid=530202)



Y_ini , questions - Sarra - 05.08.2014

Hello I'm learning scripting and I'm trying to make a Login/register system myself. It'll be difficult for me as a beginner, but it will certainly enlarge my knwoledge.
Anyway here are my questions:

For now All I want is: when the player enters a password in the DialogBox a new ini with his name will be created (exp: playerA.INI) and the password will be added to the ini and then, another variable called "userpass" should get the player's password from the ini file (i know it's stupid but just answer me please)

So here is the code I created (I'm not sure about it)
pawn Код:
INI:playernameini[Password](name[], value[])
{
    new userpass[25];
    INI_String("password", userpass, sizeof(userpass));

}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (!response) Kick(playerid);
else if (response)
{

    new playernameini[MAX_PLAYER_NAME+4], playername[MAX_PLAYER_NAME];
 
    GetPlayerName(playerid, playername, sizeof(playername));
    format(playernameini, sizeof(playernameini), "%s.INI", playername);
    new INI:data=INI_Open(playernameini);
    INI_SetTag(data, "Password");
    INI_WriteString(data, "password", inputtext);
    INI_Load(playernameini);
    printf("pass is %s", userpass);
   
    INI_Close(data);
}
return 1;
}
So, Will playernameini ,which is as far as i know a local variable, work in the INI:function ?
and i'm getting this error
Код:
(299) : error 017: undefined symbol "userpass"
, well userpass should contain the player's password, why doesn't it work when I INI_Load(playernameini) under
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
please take your time, if you can't understand me tell me so I can explain, and put in mind that I am a beginner and I started from 0 about 5 days ago


Re: Y_ini , questions - GeekSiMo - 06.08.2014

Remove it and use inputtext


Re: Y_ini , questions - Sarra - 06.08.2014

i know i can just use inputtext, but I want to do it that way, with the INI:function, which means I want to get the password from the ini file, and put it in a variable called userpass, I really need this, I have a goal doing it


Re: Y_ini , questions - Sarra - 06.08.2014

anyone? just tell me, shouldn't the INI_Load(playernameini); put the password value in the userpass variable?


Re: Y_ini , questions - Jack_Leslie - 06.08.2014

To fix your error
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (!response) Kick(playerid);
    else if (response)
    {

        new playernameini[MAX_PLAYER_NAME+4], playername[MAX_PLAYER_NAME];

        GetPlayerName(playerid, playername, sizeof(playername));
        format(playernameini, sizeof(playernameini), "%s.INI", playername);
        new INI:data=INI_Open(playernameini);
        INI_SetTag(data, "Password");
        INI_WriteString(data, "password", inputtext);
        INI_Load(playernameini);
        printf("pass is %s", inputtext);

        INI_Close(data);
    }
    return 1;
}



Re: Y_ini , questions - Sarra - 06.08.2014

Noooo euhh..
I know I can just use inputtext, hmmm alright I'll ask the question in a different way, does the my INI_Load give a return containing the password value and puts it i n the userpass variable? If no how can I fix it so I can get the password in the userpass variable usung the INI:function, because this is just the beginning, later I'll have to compare inputtext with the password in the INI file!
----------------------
at least tell me why am I getting this error ?


Re: Y_ini , questions - Sarra - 06.08.2014

Just Close this , I'll keep trying, thanks


Re: Y_ini , questions - Infern0 - 06.08.2014

I think you should see this http://forum.sa-mp.com/showthread.ph...ighlight=y_ini