View Single Post
Old 11/02/2018, 04:19 PM   #8
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 24
Reputation: 5
Default Re: Ini files not being written

Code:
#define USER_PATH "/Users/%s.ini"
Code:
UserPath(playerid){

    // Declare our variables used in this function
    new
        str[36], // 'str' will be our variable used to format a string, the size of that string will never exceed 36 characters.
        name[MAX_PLAYER_NAME]; // 'name' will be our variable used to store the player's name in the scope of this function. MAX_PLAYER_NAME is defined as 24.

    // Get the player's name.
    GetPlayerName(playerid, name, sizeof(name));

    // Format USER_PATH with the name that we got with GetPlayerName.
    format(str, sizeof(str), USER_PATH, name); // USER_PATH has been defined as: "/Users/%s.ini", %s will be replaced the player's name.
    return str;
}
Code:
new INI:file = INI_Open(UserPath(playerid));
                INI_SetTag(file, "PlayerData");
                INI_WriteString(file, "Password", PlayerInfo[playerid][Password]);
                INI_Close(file);
matje is offline   Reply With Quote