01.03.2008, 14:37
SimpleFiles.inc - Save your accounts as easy as never before
SimpleFiles is an include to save accounts.
I though i want to create a file include which is clear and easy to use.
So i started to create SimpleFiles:
-It's based on dini and dutils and it also includes "encode" and "decode" from dudb.
-The passwords are in hash format.
-There are only easy functions
-The second pack includes a Register+Login FS
_________________________________________________
© Copyright by Rafelder
Credits to:
-DracoBlue for encode and decode
-wiki.sa-mp for hash
-Rafelder for SimpleFiles
_________________________________________________
Register+Login FS:
-Command: /register [password], /login [password], /setpass [old password] [new password] [new password again]
-Saves just money at the moment but you can edit it.
-Scripted with SimpleFiles
_________________________________________________
FileCreate(filename[], password[]);
Creates a new files with an hash password if it doesn't exist already.
FileDelete(filename[]);
Deletes a file if the filename exists.
FileExists(filename[])
Checks if the filename exists.
SaveFileString(filename[], key[], string[]);
Saves a string into a given key in a given file.
SaveFileInteger(filename[], key[], integer);
Saves a integer into a given key in a given file.
SaveFileFloat(filename[], key[], Float:float);
Saves a float into a given key in a given file.
GetFileString(filename[], key[]);
Returns a string of a given key in a given file.
GetFileInteger(filename[], key[]);
Returns a integer of a given key in a given file.
GetFileFloat(filename[], key[]);
Returns a float of a given key in a given file.
IsRightPassword(filename[], password[])
Checks the password with hash.
ChangePassword(filename[], newpassword[]);
Changes the password in hash format.
EditFileName(filename[], newname[]);
Changes the filename.
_________________________________________________
To check a password (for example in /login) use:
_________________________________________________
Please write a comment if you download the file
I would be happy.
SimpleFiles.inc + Testmode <=> SimpleFiles.inc + Testmode + Register/Login FS
SimpleFiles is an include to save accounts.
I though i want to create a file include which is clear and easy to use.
So i started to create SimpleFiles:
-It's based on dini and dutils and it also includes "encode" and "decode" from dudb.
-The passwords are in hash format.
-There are only easy functions
-The second pack includes a Register+Login FS
_________________________________________________
© Copyright by Rafelder
Credits to:
-DracoBlue for encode and decode
-wiki.sa-mp for hash
-Rafelder for SimpleFiles
_________________________________________________
Register+Login FS:
-Command: /register [password], /login [password], /setpass [old password] [new password] [new password again]
-Saves just money at the moment but you can edit it.
-Scripted with SimpleFiles
_________________________________________________
FileCreate(filename[], password[]);
Creates a new files with an hash password if it doesn't exist already.
FileDelete(filename[]);
Deletes a file if the filename exists.
FileExists(filename[])
Checks if the filename exists.
SaveFileString(filename[], key[], string[]);
Saves a string into a given key in a given file.
SaveFileInteger(filename[], key[], integer);
Saves a integer into a given key in a given file.
SaveFileFloat(filename[], key[], Float:float);
Saves a float into a given key in a given file.
GetFileString(filename[], key[]);
Returns a string of a given key in a given file.
GetFileInteger(filename[], key[]);
Returns a integer of a given key in a given file.
GetFileFloat(filename[], key[]);
Returns a float of a given key in a given file.
IsRightPassword(filename[], password[])
Checks the password with hash.
ChangePassword(filename[], newpassword[]);
Changes the password in hash format.
EditFileName(filename[], newname[]);
Changes the filename.
_________________________________________________
To check a password (for example in /login) use:
pawn Код:
if (strcmp(cmd, "/login", true) == 0)
{
new playerpassword[256];
playerpassword = strtok(cmdtext, idx);
if (IsRightPassword(PlayerName(playerid), playerpassword)) {//Use this line to check passwords
//Do something if its right
} else {
//Do something if its wrong
}
return 1;
}
Please write a comment if you download the file
I would be happy.
SimpleFiles.inc + Testmode <=> SimpleFiles.inc + Testmode + Register/Login FS