SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 11/02/2018, 03:30 PM   #1
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 19
Reputation: 0
Default Ini files not being written

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.
matje is offline   Reply With Quote
Old 11/02/2018, 03:34 PM   #2
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 19
Reputation: 0
Default Re: Ini files not being written

Forgot to mention - all plugins/includes are there and they are working fine.
matje is offline   Reply With Quote
Old 11/02/2018, 03:35 PM   #3
iKarim
Gangsta
 
iKarim's Avatar
 
Join Date: Oct 2015
Posts: 587
Reputation: 133
Default Re: Ini files not being written

Might be a permission issue, double check the scriptfiles folder permissions. Also, is it a shared host (aka game server hosting) or a VPS?
iKarim is offline   Reply With Quote
Old 11/02/2018, 03:37 PM   #4
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 19
Reputation: 0
Default Re: Ini files not being written

Also configured the permissions already. It is game server hosting.
matje is offline   Reply With Quote
Old 11/02/2018, 03:39 PM   #5
iKarim
Gangsta
 
iKarim's Avatar
 
Join Date: Oct 2015
Posts: 587
Reputation: 133
Default Re: Ini files not being written

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)
iKarim is offline   Reply With Quote
Old 11/02/2018, 03:59 PM   #6
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 19
Reputation: 0
Default Re: Ini files not being written

Y_Ini. Checked, not crashing. I tried saving just one line on player disconnect, still does not write anything to the file.
matje is offline   Reply With Quote
Old 11/02/2018, 04:10 PM   #7
iKarim
Gangsta
 
iKarim's Avatar
 
Join Date: Oct 2015
Posts: 587
Reputation: 133
Default Re: Ini files not being written

What's your saving path (for scriptfiles folder) that you use with y_ini open function please?
iKarim is offline   Reply With Quote
Old 11/02/2018, 04:19 PM   #8
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 19
Reputation: 0
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
Old 11/02/2018, 04:23 PM   #9
iKarim
Gangsta
 
iKarim's Avatar
 
Join Date: Oct 2015
Posts: 587
Reputation: 133
Default Re: Ini files not being written

Quote:
Originally Posted by matje View Post
Code:
#define USER_PATH "/Users/%s.ini"

This might be the issue, try removing the first slash, so it becomes:

PHP Code:
#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.
iKarim is offline   Reply With Quote
Old 11/02/2018, 04:32 PM   #10
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 19
Reputation: 0
Default Re: Ini files not being written

Quote:
Originally Posted by iKarim View Post
This might be the issue, try removing the first slash, so it becomes:

PHP Code:
#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
matje is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can not see what written in the chat noamch1997 Scripting Help 5 10/08/2014 03:28 PM
Worst code you've written RajatPawar Discussion 24 13/07/2014 06:05 PM
What if SA-MP was written in...? ACI Everything and Nothing 56 19/03/2014 07:22 AM
What language was SA written in? glbracer Everything and Nothing 4 07/04/2013 07:12 PM
[Tool/Web/Other] JSA-MP - SA-MP library written in Java. Faab234 Tools and Files 8 17/07/2011 09:54 AM


All times are GMT. The time now is 06:43 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.