[DFile] Player's account problem.
#1

Hi SAMP forum! I had really nice help my last times from you and I thank you for that
I have problem with DFile file system, when my player created his account, for example:
John_Smith
then if he joins to the server on nickname: john_smith, code: dfile_FileExists(hisName) cannot find his created account.
Any solutions? :/
Reply
#2

I assume you're running on Linux?

File names are case-sensitive there, so "File" is not the same as "file".

To make it non-case-sensitive you can convert all file names to lower case and always opening files with lower case. So that "John_Smith" will be saved as "john_smith", as result a player named "jOhN_smiTh" will also be able to login to that account since the file "john_smith" will be used.

To do this, wherever you open the User File, convert the filename to lower case, for example like this:

Код:
new filename[]; // Your file name

for(new i, len = strlen(filename); i < len; i ++) filename[i] = tolower(filename[i]);
All it does is loop through the string, and convert each character to a lower-case character.


That's one way to do it, the other way could be saving all Player Names in a Database with correct cases, searching for the matching case and forcing that name upon the joined player.
Reply
#3

Yes, the server is running on Linux, thank you for your reply, I didn't know it works diffrent on Linux, thank you!
You are the best!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)