Login/Register
#1

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));
}
Reply
#2

bumpetibump

What I need is some function that Checks if the entered password is the same as the one in the file...
Reply
#3

Why don't you just use dini?
Reply
#4

Because I don't want to..
I want to make it all...
Reply
#5

You need to parse the information in the file using fread

Assign the password to a variable/array then just compare as normal
Reply
#6

like:
pawn Код:
new password[64];

//Then

format(pLine, sizeof(pLine), "pass=%s\n", PlayerInfo[playerid][pPass]); fread(filename, pLine);
if(pLine == password) ??
or what ?
Reply
#7

Are you encrypting your passwords?
Reply
#8

No, I will get to that later, first of I just want to make sure how to make it work ...
Reply
#9

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.
Reply
#10

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)