SA-MP Forums Archive
[Include] [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ (/showthread.php?tid=28357)

Pages: 1 2


[INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Rafelder_GRF - 01.03.2008

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:
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



Re: [INC]SimpleFiles - Save your accounts as easy as never before - kc - 01.03.2008

oooh nice


Re: [INC]SimpleFiles - Save your accounts as easy as never before - cmg4life - 01.03.2008

N I C E !!!!


Re: [INC]SimpleFiles - Save your accounts as easy as never before - Rafelder_GRF - 01.03.2008

Quote:
Originally Posted by [M
kc ]
oooh nice
Quote:
Originally Posted by [M
cmg4life ]
N I C E !!!!
Thanks and thanks


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Maniek - 01.03.2008

Wath is best? Dini or SimpleFiles?

//EDIT: 100 post


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Pixels^ - 01.03.2008

It's basically the same exact thing with name changes and adding of passwords.


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Numhaken - 01.03.2008

Nice enough


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Maniek - 01.03.2008

Buth dini it takes many memories


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Rafelder_GRF - 01.03.2008

Quote:
Originally Posted by [P7
Pixels^ ]
It's basically the same exact thing with name changes and adding of passwords.
I said i want to have a easy include with easy functions
And dini doesn't use hash+encode+decode.
dubd uses this functions but i think dudb isn't as easy as SimpleFiles
Quote:
Originally Posted by Maniek
Wath is best? Dini or SimpleFiles?
SimpleFiles is based on dini


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Pixels^ - 01.03.2008

Quote:

Buth dini it takes many memories

Not really.
pawn Код:
//FileCreate(filename[], password[]); is the same as
dini_Create(filename[])
dini_Set(filename[],"password",password);



Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - PinkFloydLover - 02.03.2008

this is automatic yo = translation = good


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Rafelder_GRF - 02.03.2008

Quote:
Originally Posted by Cale
this is automatic yo = translation = good
Thanks

I updated the file, now it includes a Register+Login FS in SimpleFiles format.
Look at the first post.


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - zallomallo - 02.03.2008

I could hug you right now!!!! Just what I needed, Functions that proclaim!! the name.


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - waxhunter - 02.03.2008

THANNNNKSSSSS!!!!!!!!!! Man ur a god i needed this to create my rpg server and i dont know how to use dudb thanks mannnn!!!!!!!!!!!!!!!


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Rafelder_GRF - 02.03.2008

Quote:
Originally Posted by waxhunter
i needed this to create my rpg server and i dont know how to use dudb thanks mannnn!
Thats the reason why i made this include. Thanks


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - cmg4life - 14.03.2008

hey so i did a stats saving thing, well , saves them , but doesnt load them, WHY ?

http://pawn.pastebin.com/m7cfb041f

and the prints show up :P


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Rafelder_GRF - 14.03.2008

Because SimpleFiles saves files as txt file: *.txt


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - cmg4life - 14.03.2008

so instead of ini i use .txt ?

tryed now doesnt save/load a thing


could u do it working ? also i removed password[] from FileCreate :P



Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - Cakeman - 17.03.2008

Nice one! I've just checked it out but, the weird thing is that it can't compile. I get 7 errors, 6 of these: "array sizes do not match, or destination array is too small" and one "symbol already defined: "strtok". I realize that it says it has strtok already defined, so I placed // in front of the "extra strtok" and my PAWN compiler crashed. The "array sizes do not match..." are caused by the extra strtok, but I really have no idea how to fix it. Do you have maybe any idea on what else could I try to fix up these errors?


Re: [INC]SimpleFiles - ۞ Save your accounts as easy as never before ۞ - mave_man - 17.03.2008

nice