SA-MP Forums Archive
Ini files not being written - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Ini files not being written (/showthread.php?tid=649591)



Ini files not being written - matje - 11.02.2018

I have set up my server on streamline servers hosting, everything seems to be working fine except the user saving system. The server creates a user file like it should but does not save anything inside it, making the file blank. Im using all the exact same files and configuration on this hosting as Im using on my localhost, where the saving system works perfectly fine. Im not sure what could be the issue. Thanks.


Re: Ini files not being written - matje - 11.02.2018

Forgot to mention - all plugins/includes are there and they are working fine.


Re: Ini files not being written - iKarim - 11.02.2018

Might be a permission issue, double check the scriptfiles folder permissions. Also, is it a shared host (aka game server hosting) or a VPS?


Re: Ini files not being written - matje - 11.02.2018

Also configured the permissions already. It is game server hosting.


Re: Ini files not being written - iKarim - 11.02.2018

Which INI system do you use? Are you sure the code isn't crashing after the file is created for some reason? (check with debug lines if you aren't sure)


Re: Ini files not being written - matje - 11.02.2018

Y_Ini. Checked, not crashing. I tried saving just one line on player disconnect, still does not write anything to the file.


Re: Ini files not being written - iKarim - 11.02.2018

What's your saving path (for scriptfiles folder) that you use with y_ini open function please?


Re: Ini files not being written - matje - 11.02.2018

Код:
#define USER_PATH "/Users/%s.ini"
Код:
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;
}
Код:
new INI:file = INI_Open(UserPath(playerid));
                INI_SetTag(file, "PlayerData");
                INI_WriteString(file, "Password", PlayerInfo[playerid][Password]);
                INI_Close(file);



Re: Ini files not being written - iKarim - 11.02.2018

Quote:
Originally Posted by matje
Посмотреть сообщение
Код:
#define USER_PATH "/Users/%s.ini"
This might be the issue, try removing the first slash, so it becomes:

PHP код:
#define USER_PATH "Users/%s.ini" 
The reason is, Linux systems handle the trailing / differently, in Linux the path becomes /Users/whatever.ini when there's a trailing slash while it's supposed to be /path/to/scriptfiles/Users/whatever.ini.


Re: Ini files not being written - matje - 11.02.2018

Quote:
Originally Posted by iKarim
Посмотреть сообщение
This might be the issue, try removing the first slash, so it becomes:

PHP код:
#define USER_PATH "Users/%s.ini" 
The reason is, Linux systems handle the trailing / differently, in Linux the path becomes /Users/whatever.ini when there's a trailing slash while it's supposed to be /path/to/scriptfiles/Users/whatever.ini.
Unfortunately, no luck. I've opened a ticket to their support team, but I doubt they will be able to help me. Thanks anyways