02.11.2013, 09:37
Hello,
I'm trying to load some items with y_ini, I'm using ParseFile to be exact:
And because Y_Ini calls the function "LoadItems" on every INI_Int, the loop gets executed three times!
I was loading three items and printed out the i inside the loop, i got this:
I know that's there's nothing wrong with y_ini but my question is how do I prevent it from loading some stuff multiple times? That's not a problem when there's three items, but what if someday I'll add three hundred?
Another problem(which is probably my error): variable "tmp" is always loaded. My key is correct(i use the same loop to save items).
I'm trying to load some items with y_ini, I'm using ParseFile to be exact:
pawn Code:
INI_ParseFile(path,"Load_%s", .bExtra = true, .extra = playerid);
pawn Code:
forward Load_Items(playerid,name[],value[]);
public Load_Items(playerid,name[],value[])
{
new tmp;
for(new i; i < MAX_ITEMS; i++)
{
if(isnull(UsableItems[i])) break;
INI_Int(UsableItems[i],tmp);
if(tmp) SetPVarInt(playerid,UsableItems[i],tmp);
}
return 1;
}
I was loading three items and printed out the i inside the loop, i got this:
pawn Code:
i = 0
i = 0
i = 1
i = 0
i = 1
i = 2
Another problem(which is probably my error): variable "tmp" is always loaded. My key is correct(i use the same loop to save items).