20.09.2014, 19:12
Hello,
I got this next command:
My question is, how can I make a load function using y_ini? This is my first time using y_ini and I didn't really understand the INI_ParseFile. This is the load function:
(I know its wrong, I just gave the basic)
By the way, I need it to load the whole 200 tags (200 items).
Thanks!
I got this next command:
pawn Код:
new INI: itemsfile = INI_Open("Items.txt");
new string[256];
for(new i = 0; i < MAX_OBJ; i ++)
{
format(string, sizeof(string), "Item%d", i);
INI_SetTag(itemsfile, string);
format(string, sizeof(string), "Item%dItem", i);
INI_WriteInt(itemsfile, string, 0);
format(string, sizeof(string), "Item%dPosX", i);
INI_WriteFloat(itemsfile, string, 0);
format(string, sizeof(string), "Item%dPosY", i);
INI_WriteFloat(itemsfile, string, 0);
format(string, sizeof(string), "Item%dPosZ", i);
INI_WriteFloat(itemsfile, string, 0);
}
INI_Close(itemsfile);
pawn Код:
stock LoadItems()
{
new string[128], INI: file = INI_Open("Items.txt");
for(new j = 0; j < MAX_OBJ; j ++)
{
format(string, 128, "Item%dItem", j);
jData[j][Item] = INI_Int(file, string);
format(string, 128, "Item%dPosX", j);
jData[j][ItemX] = INI_Int(file, string);
format(string, 128, "Item%dPosY", j);
jData[j][ItemY] = INI_Int(file, string);
format(string, 128, "Item%dPosZ", j);
jData[j][ItemZ] = INI_Int(file, string);
}
INI_Close(file);
return 1;
}
By the way, I need it to load the whole 200 tags (200 items).
Thanks!