y_ini not loading file. -
Facerafter - 07.06.2013
My Y_ini is not loading the file. Im 100 % sure it saves. But it doesn't load.
Load public.
pawn Код:
forward load_factions(name[], value[]);
public load_factions(name[], value[])
{
INI_Int("LSPDLeader", FacInfo[1][facLeader]);
INI_Int("LSPDMembers", FacInfo[1][facMembers]);
INI_Int("Rank0", FacInfo[1][fRank0]);
INI_Int("Rank1", FacInfo[1][fRank1]);
INI_Int("Rank2", FacInfo[1][fRank2]);
INI_Int("Rank3", FacInfo[1][fRank3]);
INI_Int("Rank4", FacInfo[1][fRank4]);
INI_Int("Rank5", FacInfo[1][fRank5]);
INI_Int("Rank6", FacInfo[1][fRank6]);
INI_Int("Rank7", FacInfo[1][fRank7]);
INI_Int("Rank8", FacInfo[1][fRank8]);
INI_Int("Rank9", FacInfo[1][fRank9]);
INI_Int("Rank10", FacInfo[1][fRank10]);
INI_Int("Div1", FacInfo[1][fDiv1]);
INI_Int("Div2", FacInfo[1][fDiv2]);
INI_Int("Div3", FacInfo[1][fDiv3]);
INI_Int("Div4", FacInfo[1][fDiv4]);
return 1;
}
And here the OnGameModeInIt where the while needs to be loaded but it doesn't
pawn Код:
public OnGameModeInIt()
{
INI_ParseFile("factions/lspd.INI", "load_factions", .bExtra = false);
return 1;
}
Re: y_ini not loading file. -
gtakillerIV - 07.06.2013
I think it should be:
pawn Код:
forward loadfactions_data(name[], value[]);
public loadfactions_data(name[], value[])
Now use it like this:
pawn Код:
INI_ParseFile("factions/lspd.INI", "loadfactions_%s", .bExtra = false);
EDIT: Oh, you're not loading it for a player.
I think you can just load it as:
pawn Код:
INI_ParseFile("factions/lspd.INI", "load_factions", .bExtra = false);
Re: y_ini not loading file. -
Tingesport - 07.06.2013
Make a loop with Foreach or use..
NORMAL LOOP
pawn Код:
for(new i = 0; i < MAX_FACTIONS; i++)
{
// LOADING HERE
}
FOREACH LOOP
pawn Код:
foreach (new i : MAX_FACTIONS)
{
// LOADING HERE
}
EXAMPLE LOOP ONGAMEMODEINIT
pawn Код:
for(new idx = 1; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
{
format(str, sizeof(str), BPATH, idx);//formats the file path, with the biz ID
INI_ParseFile(str, "loadbiz_%s", .bExtra = true, .extra = idx );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
}
EDIT: Does it reset when you connect?
Re: y_ini not loading file. -
Facerafter - 07.06.2013
Oeps this was from a dutch topic were they said i had to do this:
pawn Код:
INI_ParseFile("factions/lspd.INI", "loadfactions_%s", .bExtra = false);
But i have i like this:
pawn Код:
INI_ParseFile("factions/lspd.INI", "load_factions", .bExtra = false);
So the _%s is not in my GM.
And no im not loading it for a player.
Look,
I have /adjustrankname
Wich puts the name into a enum
And my SaveFactions() write's the enum into .ini file.
Wich is supposed to load on OnGameModeInit. So it can go back into enum
And load for example /stats Division: Rank:, or /radio Rank PlayerName: Text.
Thats what is supposed to do.
Everything works until it's loading on GameModeInit. It saves perfectly. It just doesn't load.
Re: y_ini not loading file. -
Facerafter - 07.06.2013
~ Bump ~
Re: y_ini not loading file. -
gtakillerIV - 07.06.2013
Dude, the "%s" is for the extra parameter, which you're not even adding. We usually use it for "playerid".
Re: y_ini not loading file. -
Facerafter - 07.06.2013
What are you trying to say?
I said i DON'T use the %s in my GM, because im not loading it for a player.
Re: y_ini not loading file. -
Facerafter - 08.06.2013
Bump