Something's wrong with saving to file (y_ini)
#1

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)
Reply
#2

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?
Reply
#3

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...
Reply
#4

#define MAX_SLOTS 20

to

#define MAX_SLOTS 21
Reply
#5

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...'.
Reply
#6

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

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.
Reply
#8

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?
Reply
#9

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

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)