Login/Register - 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: Login/Register (
/showthread.php?tid=169164)
Login/Register -
Lorrden - 18.08.2010
Okay, so I've allways used dudb when creating scripts.
Now i thought it'd be time for me to advance a bit so I decided to drop the includes.
I've solved the Register system, it should work without troubles..
However, when I got to OnPlayerLogin... I got stuck.
So I would really appriciate if someone could help me out here
This is what i got...
pawn Код:
public OnPlayerLogin(playerid, Password[])
{
new string[128];
format(string, sizeof(string), "RPG/Accounts/%s.cfg", Name(playerid));
new File:flogin = fopen(string, io_read);
if(flogin)
{
//How do I make the server check if "Password" is equal to the files pass line??
}
return printf("Player %s has logged in.", Name(playerid));
}
Re: Login/Register -
Lorrden - 21.08.2010
bumpetibump
What I need is some function that Checks if the entered password is the same as the one in the file...
Re: Login/Register -
AiVAMAN - 21.08.2010
Why don't you just use dini?
Re: Login/Register -
Lorrden - 22.08.2010
Because I don't want to..
I want to make it all...
Re: Login/Register -
vital2k - 22.08.2010
You need to parse the information in the file using fread
Assign the password to a variable/array then just compare as normal
Re: Login/Register -
Lorrden - 22.08.2010
like:
pawn Код:
new password[64];
//Then
format(pLine, sizeof(pLine), "pass=%s\n", PlayerInfo[playerid][pPass]); fread(filename, pLine);
if(pLine == password) ??
or what ?
Re: Login/Register -
vital2k - 22.08.2010
Are you encrypting your passwords?
Re: Login/Register -
Lorrden - 22.08.2010
No, I will get to that later, first of I just want to make sure how to make it work ...
Re: Login/Register -
Finn - 22.08.2010
Put
fread into while-loop.
pawn Код:
while(fread(file, string, sizeof(string)))
{
print(string); // Will print every line in the file.
}
You could try to use
sscanf to parse the strings.
...Or the easiest way: just use some include which is made for this.
Re: Login/Register -
Lorrden - 22.08.2010
Maybe you didn't read the first part of my first post: ...
Quote:
--------------------------------------------------------------------------------
Okay, so I've allways used dudb when creating scripts.
Now i thought it'd be time for me to advance a bit so I decided to drop the includes.
|
How ever, this still doesn't explain how I make the script read from ONE single line in the file..