Y_ini - 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 (
/showthread.php?tid=236491)
Y_ini -
Stefans94 - 07.03.2011
Hello, i'm a noob at samp scripting,
and i'm trying to make a login/register dialog using Y_INI
(IT'S NOT DONE YET)
now.. i can write to the INI file.. so register works...
Can anyone help me with these things:
- Make the login work (reading, because when i do what the Y_ini thread says, it doesn't work)
- How to hash the password?
Thanks!
Here is the code:
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pname[128], account[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(account, sizeof(account), "Accounts/%s.ini", pname);
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "SF:RP - Register", "You didn't enter a password, please enter a password!", "Register", "Leave");
return 0;
}
if(!fexist(account))
{
new
INI:ini = INI_Open(account);
INI_WriteString(ini, "username", pname);
INI_WriteString(ini, "password", inputtext);
INI_Close(ini);
GivePlayerMoney(playerid, 1000);
}
}
}
if(dialogid == DIALOG_LOGIN)
{
if(!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "SF:RP - Login", "You didn't enter a password, please enter a password!", "Login", "Leave");
return 0;
}
if(fexist(account))
{
//login
}
}
}
return 1;
}
And if there is any one who wants to add me on msn, so who can help me when i have a question..
send me a PM
Re: Y_ini -
sim_sima - 07.03.2011
Use dini in stead, much easier.
Re: Y_ini -
Zh3r0 - 07.03.2011
https://sampforum.blast.hk/showthread.php?tid=210277
https://sampforum.blast.hk/showthread.php?tid=65290
Re: Y_ini -
Mean - 07.03.2011
Example of reading:
pawn Code:
forward LoadMyStats( playerid, name[ ], value[ ] );
public LoadMyStats( playerid, name[ ], value[ ] )
{
if( !strcmp( name, "Score", false ) )
SetPlayerScore( playerid, strval( value ) );
return true;
}
To load the score from file:
pawn Code:
INI_ParseFile( account, "LoadMyStats", false, true, playerid, true, false );
Simplest way I can think of.
Re: Y_ini -
Stigg - 07.03.2011
I use y_ini, it's simply class.
Well worth learning.