SA-MP Forums Archive
Saving inputtext! - 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: Saving inputtext! (/showthread.php?tid=423755)



Saving inputtext! - SeYziicH - 19.03.2013

Hey, i am creating register system so..
I have one dialog that enters password then when entered it shows next dialog where that password is shown (for check) when i click "Done" in that second password in my .INI file password sould be created.

I did it on this way....
Код:
MyPassword[playerid] = strlen(inputtext);
dini_Set(path, "Lozinka", MyPassword[playerid]);
(Have in mind that i cant replace MyPassword[playerid] with inputtext cuz of 2 different dialog's)

But when i enter at my .INI it show's
Код:
Lozinka=



Re: Saving inputtext! - Konstantinos - 19.03.2013

I don't really understand, but..

check if the password is valid, not null etc and save it on the MyPassword[playerid] variable. Then on the second dialog, save it according to the variable above.

If I'm mistaken, then please correct me and explain me once again.


Re: Saving inputtext! - SeYziicH - 19.03.2013

I tryied MyPassword[playerid] = strlen(inputtext); but it return's blank :S!

So i have
Код:
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "INPUT PASSWORD", string, "Dalje", "Natrag");

if(dialogid == 3)
{
new string[256];
format(string, sizeof(string), "You entered password: %s is it correct?", inputtext);
MyPassword[playerid] = strlen(inputtext);
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "PASSWORD CHECK", string, "Done", "Natrag");
}

if(dialogid == 4)
{
dini_Set(path, "Lozinka", MyPassword[playerid]);
}
And when i open my file it shows this:



Re: Saving inputtext! - Konstantinos - 19.03.2013

strlen(inputtext) will count how many chars there are in the inputtext.

If MyPassword[playerid] is a string, then use:
pawn Код:
format(MyPassword[playerid], sizeof(MyPassword[playerid]), inputtext);



Re: Saving inputtext! - Vince - 19.03.2013

That won't work. To get the size of the second dimension in an array you'd use
pawn Код:
sizeof(MyPassword[])



Re: Saving inputtext! - SeYziicH - 19.03.2013

Fixed with strmid
Thanks for help