INI files not loading?
#1

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!
Reply
#2

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);
Reply
#3

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);
}

Reply
#4

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

1.ini etc.
Reply
#6

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
}
Reply
#7

Sorry bt uhm.. What exactly changed? :P
Reply
#8

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);
Reply
#9

Changed and not fixed unfortunately .
Reply
#10

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);
	}
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)