SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 07/03/2011, 04:09 PM   #1
Stefans94
Big Clucker
 
Join Date: Nov 2010
Posts: 75
Reputation: 0
Default Y_ini

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
Stefans94 is offline  
Old 07/03/2011, 06:23 PM   #2
sim_sima
Gangsta
 
Join Date: Mar 2010
Posts: 697
Reputation: 26
Default Re: Y_ini

Use dini in stead, much easier.
sim_sima is offline  
Old 07/03/2011, 06:49 PM   #3
Zh3r0
High-roller
 
Join Date: Mar 2008
Posts: 4,512
Reputation: 398
Default Re: Y_ini

http://forum.sa-mp.com/showthread.php?t=210277
http://forum.sa-mp.com/showthread.php?t=65290
__________________
Zh3r0 is offline  
Old 07/03/2011, 07:07 PM   #4
Mean
High-roller
 
Join Date: Jul 2010
Location: 14th annual lemon party
Posts: 2,726
Reputation: 229
Default Re: Y_ini

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.
__________________
I'm pretty much the creator of the PUB: macro used in many scripts today, therefore I'm a legitimate genius.

Ground breaking stuff
Quote:
Originally Posted by ******
I've met Mean on a few occasions in real life, a true genius and a 400 pound all-muscle gorilla alpha male. He has had a great influence on my life.
Quote:
Originally Posted by Kalcor
I don't know where I'd be today without Mean. He has helped me through some tough times in my life. He always brings a smile to my face. Such a positive lad!
Mean is offline  
Old 07/03/2011, 07:57 PM   #5
Stigg
High-roller
 
Stigg's Avatar
 
Join Date: Aug 2010
Location: Other side of the Universe.
Posts: 2,038
Reputation: 125
Default Re: Y_ini

I use y_ini, it's simply class.
Well worth learning.
__________________

Peace...

Stigg 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
[HELP] How to use Y_INI gamer931215 Help Archive 2 06/03/2011 11:14 AM
Need help with y_ini. MikkelPetersen Help Archive 1 08/02/2011 05:37 PM
y_ini Help Linus- Help Archive 6 22/01/2011 01:09 PM
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


All times are GMT. The time now is 06:00 PM.


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