y_ini reading problem
#1

I can't find where the problem is:
pawn Код:
INI:words[](name[], value[])
{
    new posHolder[16];
    printf("Word count: %d", wordCount);
    for(new i = 0; i < wordCount; i++) {
        //if(forbiddenWordSlotUsed[i]) {
            format(posHolder, sizeof posHolder, "Word_%d", i);
            INI_String(posHolder, forbiddenWords[i], MAX_WORD_LENGTH);
            new l = AddForbiddenWord(forbiddenWords[i], strlen(forbiddenWords[i]));
            printf("Forbidden word %s loaded (%d)", forbiddenWords[i], l);
        //}
    }
    return 0;
}
The file loading is called multiple times, debugged:
pawn Код:
Word count: 5
Word count: 5
Forbidden word x loaded (0)
Word count: 5
Forbidden word x loaded (1)
Forbidden word x loaded (2)
Word count: 5
Forbidden word x loaded (3)
Forbidden word x loaded (4)
Forbidden word y loaded (5)
Word count: 5
Forbidden word x loaded (6)
Forbidden word x loaded (7)
Forbidden word y loaded (8)
Forbidden word z loaded (9)
As you see, the same word ('x') is loaded multiple times, the second and third once, and the fourth and fifth aren't loaded at all. What the heck?

The files are saved normally. The 'words.ini' file:
pawn Код:
Word_0 = x
Word_1 = y
Word_2 = z
Word_3 = x1
Word_4 = y1
x1 and y1 are not touched.

Oh, and by the way, INI_Load is only called ONCE in OnFilterScriptInit.
Reply
#2

Bump
Reply
#3

This seems to be a common problem: https://sampforum.blast.hk/showthread.php?tid=473278 Yet no answer for it.
Reply
#4

Quote:
Originally Posted by dusk
Посмотреть сообщение
This seems to be a common problem: https://sampforum.blast.hk/showthread.php?tid=473278 Yet no answer for it.
Oh, I see. Thanks for pointing that out.
Is there any other way I can load files with y_ini?
Reply
#5

MySQL if that's an option.
Reply
#6

Or you may try using y_ini from YSI 4.0. Although I'm not sure if was changed...
Reply
#7

Using version 4.0 didn't change anything unfortunately.
MySQL? Why would I use MySQL?

Anyway, I'll try to get ****** to see what's up with INI_Load
Reply
#8

Well MySQL is a nice alternative for storing data.
Reply
#9

Quote:
Originally Posted by dusk
Посмотреть сообщение
Well MySQL is a nice alternative for storing data.
I never learned and don't want to learn (not to mention changing my whole script to MySQL) it.
Thanks anyway for this tip.

But does anyone know how to solve this problem and continue using y_ini?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)