SA-MP Forums Archive
Loop through 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: Loop through Y_INI (/showthread.php?tid=458875)



Loop through Y_INI - ProjectMan - 18.08.2013

Hello, is looping through a Y_INI tag possible?
Here is what I want to achieve:

For example in the .ini file:

pawn Код:
[exampletag]
blabla1 = 1  //1
blabla2 = 0  //2
blabla3 = 1  //3
blabla4 = 1  //4
blabla5 = 1  //5
I want to do a check through each one of the value of the tag (there are 5).

The questions:
1. How do I know there are 5 values under the [exampletag]?
2. How do I write a function loop that does something like this:

pawn Код:
enum exampletag
{
    blabla1,
    blabla2,
    blabla3,
    blabla4,
    blabla5
};
new BlaBlaInfo[MAX_PLAYERS][exampletag];

for (new i; i < sizeof(exampletag); i++)
{
    if (BlaBlaInfo[playerid][i] == 1)
    {
    // code
    }
}
If you don't understand it, tell me, I will try to explain it.


Re: Loop through Y_INI - ProjectMan - 18.08.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
The INI_ParseFile already loops through items - that's the entire basis of the design of y_ini.
Is there a way to get the total items count under a tag and also insert a code for each line check?