23.04.2013, 21:33
Alright, I am trying to create a dynamic teleport system, and I have everything pretty much down, except for the loading system. Everything saves perfect, it just doesn't load. I am still having trouble grasping Y_INI, so please bare with me.
Saving Code:
Loading Code:
Parsing The File: (Under OnFilterScriptInit())
I have read through all of the tutorials for Y_INI, tried using the tag option, and everything, and it will not properly load. Hope someone can help, thank you.
- zDivine
Saving Code:
pawn Код:
forward SaveTeleports();
public SaveTeleports()
{
new string[128];
new INI:File = INI_Open("teleports.cfg");
INI_SetTag(File, "teles");
for(new i = 0; i < MAX_TELES; i++)
{
format(string, sizeof(string), "Tele%dName", i);
INI_WriteString(File, string, TeleInfo[i][tName]);
format(string, sizeof(string), "Tele%dX", i);
INI_WriteFloat(File, string, TeleInfo[i][tX]);
format(string, sizeof(string), "Tele%dY", i);
INI_WriteFloat(File, string, TeleInfo[i][tY]);
format(string, sizeof(string), "Tele%dZ", i);
INI_WriteFloat(File, string, TeleInfo[i][tZ]);
format(string, sizeof(string), "Tele%dA", i);
INI_WriteFloat(File, string, TeleInfo[i][tA]);
format(string, sizeof(string), "Tele%dVW", i);
INI_WriteInt(File, string, TeleInfo[i][tVW]);
format(string, sizeof(string), "Tele%dInt", i);
INI_WriteInt(File, string, TeleInfo[i][tInt]);
}
INI_Close(File);
return 1;
}
pawn Код:
forward LoadTeleports(name[], value[]);
public LoadTeleports(name[], value[])
{
new string[128];
for(new i = 0; i < MAX_TELES; i++)
{
format(string, sizeof(string), "Tele%dName", i);
INI_String(string, TeleInfo[i][tName], strlen(TeleInfo[i][tName]));
format(string, sizeof(string), "Tele%dX", i);
INI_Float(string, TeleInfo[i][tX]);
format(string, sizeof(string), "Tele%dY", i);
INI_Float(string, TeleInfo[i][tY]);
format(string, sizeof(string), "Tele%dZ", i);
INI_Float(string, TeleInfo[i][tZ]);
format(string, sizeof(string), "Tele%dA", i);
INI_Float(string, TeleInfo[i][tA]);
format(string, sizeof(string), "Tele%dVW", i);
INI_Int(string, TeleInfo[i][tVW]);
format(string, sizeof(string), "Tele%dInt", i);
INI_Int(string, TeleInfo[i][tInt]);
}
return 1;
}
pawn Код:
INI_ParseFile("teleports.cfg", "LoadTeleports");
- zDivine