SA-MP Forums Archive
INI files not loading? - 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: INI files not loading? (/showthread.php?tid=365044)



INI files not loading? - Devix - 01.08.2012

Hey guys!
I have the following:

INI_Load("Vehicles/%d"); at OnGameModeInit

Inside the Vehicles folder there are ini files created by a command (works and all).
But it doesnt load with this ini_load!

I also tried it with ini_parsefile but I have no idea how to use that properly.

Can I get some help please? It's very appreciated!


Re: INI files not loading? - Roko_foko - 01.08.2012

I have never used INI, but still this looks wrong for me: "Vehicles/%d".
Try using format function to store the string into some array and check with variable
Something like this:
pawn Код:
new String[35];
format(String,35,"Vehicles/%d",VehicleNumberOrWhatEverSholdHereBe);
INI_Load(String);



Re: INI files not loading? - Devix - 01.08.2012

Thats the thing, if I format %d how should I do that?

Because this: Doesn't work.

Quote:

for(new i = 0; i < MAX__VEH; ++i)
{
new string[35];
format(string, sizeof(string), "Vehicles/%d", i);
INI_Load(string);
}




Re: INI files not loading? - Roko_foko - 01.08.2012

Go to scriptfiles, enter Vehicles folder and check how are files inside named.


Re: INI files not loading? - Devix - 01.08.2012

1.ini etc.


Re: INI files not loading? - Roko_foko - 01.08.2012

I think server can load one file at the time.
This should work
pawn Код:
for(new i = 0; i < MAX__VEH; ++i)
{
new string[35];
format(string, sizeof(string), "Vehicles/%d", i);
INI_Load(string);
//work with .ini file
}



Re: INI files not loading? - Devix - 01.08.2012

Sorry bt uhm.. What exactly changed? :P


Re: INI files not loading? - Misiur - 01.08.2012

Your filenames are in form of "%number%.ini" or simply "%number%"? If the first case, you've forgotten about .ini.

pawn Код:
format(string, sizeof(string), "Vehicles/%d", i);
//Changes to
format(string, sizeof(string), "Vehicles/%d.ini", i);



Re: INI files not loading? - Devix - 01.08.2012

Changed and not fixed unfortunately .


Re: INI files not loading? - Devix - 01.08.2012

This:

Код:
forward VehDataLoad(id, name[], value[]);
public VehDataLoad(id, name[], value[])
{
Isnt working either in combination with this under ongamemode:
Код:
for(new i = 0; i < MAX__VEH; ++i)
	{
  	    new File[35];
		format(File, 35,  "Vehicles/%d.ini" ,i);
		INI_ParseFile(File, "VehDataLoad", .bExtra = true, .extra = i);
	}