[Help]y_ini saving case sensitive
#14

Quote:
Originally Posted by PRoleplay
View Post
...
You don't have to set the player's name. Use the 'UsernameToLower' function when checking the user's file:

PHP Code:
#define USER_PATH  "/users/%s.ini"
UserPath(playerid) {
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnamesizeof(name));
    
format(pathsizeof(path), USER_PATHUsernameToLower(name));
    return 
path;

The function above is then used in for example the following situations:
PHP Code:
if(fexist(UserPath(playerid))) 
PHP Code:
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra true, .extra playerid);
// Change 'LoadUser_data' to whatever your function is called.
// And _'data' to whatever your filetag is. 
This line:
PHP Code:
format(pathsizeof(path), USER_PATHUsernameToLower(name)); 
Will turn the user's name into lowercase without actually changing their names. It then returns the path of the user's file in lowercase.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)