SA-MP Forums Archive
[DFile] Player's account problem. - 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)
+--- Thread: [DFile] Player's account problem. (/showthread.php?tid=652576)



[DFile] Player's account problem. - Milak - 14.04.2018

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


Re: [DFile] Player's account problem. - NaS - 14.04.2018

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.


Re: [DFile] Player's account problem. - Milak - 14.04.2018

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!