SA-MP Forums Archive
How to load infromation that written in .ini file - 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: How to load infromation that written in .ini file (/showthread.php?tid=315536)



How to load infromation that written in .ini file - king4you - 03.02.2012

How to load infromation that written in .ini file


Re: How to load infromation that written in .ini file - milanosie - 03.02.2012

Try to "search" for Y_ini

Will help you out


Re: How to load infromation that written in .ini file - king4you - 03.02.2012

is this should work fine??

LoadTrunkFS()
{
new File:handle, count;
new filename[64], line[256];
for(new i=1; i < MAX_VEHICLES; i++)
{
format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", i);
if(!fexist(filename)) continue;
handle = fopen(filename, io_read);
while(fread(handle, line))
{
StripNL(line);
if(!line[0]) continue;
//if(strcmp(line, "Created=", false, == 0) VehicleCreated[i] = strval(line[8]);
//else if(strcmp(line, "Owner=", false, 6) == 0) strmid(VehicleOwner[i], line, 6, sizeof(line));
else if(strcmp(line, "Trunk1=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunkK[i][0][0], VehicleTrunkK[i][0][1]);
else if(strcmp(line, "Trunk2=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunkK[i][1][0], VehicleTrunkK[i][1][1]);
else if(strcmp(line, "Trunk3=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunkK[i][2][0], VehicleTrunkK[i][2][1]);
else if(strcmp(line, "Trunk4=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunkK[i][3][0], VehicleTrunkK[i][3][1]);
else if(strcmp(line, "Trunk5=", false, 7) == 0) sscanf(line[7], "p,dd", VehicleTrunkK[i][4][0], VehicleTrunkK[i][4][1]);
}
fclose(handle);
if(VehicleCreated[i]) count++;
}
printf(" Loaded %d vehicles", count);
}


Re: How to load infromation that written in .ini file - milanosie - 03.02.2012

No idea, I am using d_ini

Altough I think Y_ini is better


Re: How to load infromation that written in .ini file - king4you - 03.02.2012

Any idea how to load inforamtion from INI file? usint anyy include??


Re: How to load infromation that written in .ini file - MP2 - 03.02.2012

You've been told twice now. Dini or y_ini.


Re: How to load infromation that written in .ini file - king4you - 03.02.2012

But how usiny y_ini i dont know how to make it i cant figure out


Re: How to load infromation that written in .ini file - milanosie - 03.02.2012

Its explained the Y_Ini page.

if u think its too complicated try dini, its a bit slower thou


Re: How to load infromation that written in .ini file - king4you - 03.02.2012

Dont you have it written and i will just change the location of the ini and information that i want i get from the ini
only that way i could know how it works ..


Re: How to load infromation that written in .ini file - milanosie - 03.02.2012

That aint possible,
You will have to create an enum, define ur file, and then use the dini/y_ini ways,

Just search for tutorials or something, there are a lot of them and I guess some of them are really good and usefull.
If I would give you my script it wont help you in anything cause u will basicly need to redefine everything