SA-MP Forums Archive
Something's wrong with saving to file (y_ini) - 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: Something's wrong with saving to file (y_ini) (/showthread.php?tid=599358)



Something's wrong with saving to file (y_ini) - Amads - 24.01.2016

I feel like and idiot for not knowing what causes it.
Код:
// define at the top ofc
#define MAX_SLOTS 20


// onplayerdisconnect
new string[32];
for(new i; i < MAX_SLOTS; i++)
{
                format(string, sizeof(string), "sEQ_%d", i);
		INI_WriteInt(File, string, sEQ[playerid][i]);
}
The problem is it saves only from sEQ_0 to sEQ_18. What about sEQ_19?

I even tried doing it like this:
Код:
INI_WriteInt(File, sEQ_0, sEQ[playerid][0]);
INI_WriteInt(File, sEQ_1, sEQ[playerid][1]);
...
INI_WriteInt(File, sEQ_18, sEQ[playerid][18]);
INI_WriteInt(File, sEQ_19, sEQ[playerid][19]);
And it still doesn't save sEQ_19.

When I set #define MAX_SLOTS to 10 it works fine (saves from 0 to 9)


Re: Something's wrong with saving to file (y_ini) - Private200 - 24.01.2016

Try adding a print after:

INI_WriteInt(File, sEQ_19, sEQ[playerid][19]);

-.. in order to check if it actually executes. I've had problems in the past with Y_INI not saving a specific number. What are you trying to save anyways?


Re: Something's wrong with saving to file (y_ini) - Amads - 24.01.2016

The code executes.
Inventory slots - I can do everything with an item in slot ID 19 and it works, except for saving it to file...


Re: Something's wrong with saving to file (y_ini) - Write - 24.01.2016

#define MAX_SLOTS 20

to

#define MAX_SLOTS 21


Re: Something's wrong with saving to file (y_ini) - Amads - 24.01.2016

Quote:
Originally Posted by Write
Посмотреть сообщение
#define MAX_SLOTS 20

to

#define MAX_SLOTS 21
Quote:

When I set #define MAX_SLOTS to 10 it works fine (saves from 0 to 9)

So this is not the cause.


When I change MAX_SLOTS to 21 I can't connect to the server. It's stuck on 'connecting to...'.


Re: Something's wrong with saving to file (y_ini) - Write - 24.01.2016

There's nothing wrong in what you showed us, show us your whole code from scratch something must be conflicting with it.


Re: Something's wrong with saving to file (y_ini) - PrO.GameR - 25.01.2016

Here's a possible solution, it might be that y_ini is limited to a set number of sections (less than 20 in your case) or a set number of lines (this was what happened to me in another ini include)
you should simply increase the limits for it and it'll work fine.


Re: Something's wrong with saving to file (y_ini) - Amads - 25.01.2016

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
Here's a possible solution, it might be that y_ini is limited to a set number of sections (less than 20 in your case) or a set number of lines (this was what happened to me in another ini include)
you should simply increase the limits for it and it'll work fine.
How can I do it?


Re: Something's wrong with saving to file (y_ini) - Amunra - 25.01.2016

What Your Want Save ?
A Name ,ID Or etc ?
Код HTML:
INI_WriteInt(File, sEQ_19, sEQ[playerid][19]); //Where Your Data Enum ?



Re: Something's wrong with saving to file (y_ini) - Amads - 25.01.2016

I changed #define MAX_SLOTS to 15

I added a printf like this to check what's going on during saving process:
Код:
	for(new i; i < MAX_SLOTS; i++)
	{
	    printf("* saving slot %d", i);
		format(string, sizeof(string), "sEQ_%d", i);
		INI_Int(string, bsEQ[playerid][i]);
	}
This is what happens when I quit and this code executes:
Код:
[01:03:53] * saving slot 1
[01:03:53] * saving slot 0
[01:03:53] * saving slot 1
[01:03:53] * saving slot 2
[01:03:53] * saving slot 3
[01:03:53] * saving slot 4
[01:03:53] * saving slot 5
[01:03:53] * saving slot 6
[01:03:53] * saving slot 7
[01:03:53] * saving slot 8
[01:03:53] * saving slot 9
[01:03:53] * saving slot 10
[01:03:53] * saving slot 11
[01:03:53] * saving slot 12
[01:03:53] * saving slot 13
[01:03:53] * saving slot 14
[01:03:53] * saving slot 0
[01:03:53] * saving slot 1
[01:03:53] * saving slot 2
[01:03:53] * saving slot 3
[01:03:53] * saving slot 4
[01:03:53] * saving slot 5
[01:03:53] * saving slot 6
[01:03:53] * saving slot 7
[01:03:53] * saving slot 8
[01:03:53] * saving slot 9
[01:03:53] * saving slot 10
[01:03:53] * saving slot 11
[01:03:53] * saving slot 12
[01:03:53] * saving slot 13
[01:03:53] * saving slot 14
[01:03:53] * saving slot 0
[01:03:53] * saving slot 1
[01:03:53] * saving slot 2
[01:03:53] * saving slot 3
[01:03:53] * saving slot 4
[01:03:53] * saving slot 5
[01:03:53] * saving slot 6
[01:03:53] * saving slot 7
[01:03:53] * saving slot 8
[01:03:53] * saving slot 9
[01:03:53] * saving slot 10
[01:03:53] * saving slot 11
[01:03:53] * saving slot 12
[01:03:53] * saving slot 13
[01:03:53] * saving slot 0
[01:03:53] * saving slot 1
[01:03:53] * saving slot 2
[01:03:53] * saving slot 3
[01:03:53] * saving slot 4
[01:03:53] * saving slot 5
[01:03:53] * saving slot 6
[01:03:53] * saving slot 7
[01:03:53] * saving slot 8
[01:03:53] * saving slot 9
[01:03:53] * saving slot 10
[01:03:53] * saving slot 11
[01:03:53] * saving slot 12
[01:03:53] * saving slot 13
[01:04:06] [part] Amads has left the server (0:1)
There's A LOT more 'saving slot x' messages. So, for some reason it tries to save it over and over again. This is... weird?