Load All .ini file with dini? - 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: Load All .ini file with dini? (
/showthread.php?tid=571332)
Load All .ini file with dini? -
semara123 - 18.04.2015
hey there i have a question how to load all .ini file in 1 folder using dini
like this :
Quote:
label1.ini
label2.ini
label3.ini
label4.ini
|
it saved on label folder and how to load that file i mean load label1.ini till label4.ini(all file in label folder) using dini
anyone know how?
Re: Load All .ini file with dini? -
ATGOggy - 18.04.2015
PHP код:
stock LoadLabels()
{
new bool:Finished;
for(new i=0; !Finished; i++)
{
new string[60];
format(string, sizeof(string), "/label/label%d.ini", i);
if(fexist(string))
{
//load it here
dini_Int...blah..blah..blah
}
else
{
Finished=true;
}
}
}
Re: Load All .ini file with dini? -
Bakr - 18.04.2015
Don't use dini...it's outdated, unsupported, and one of the slowest methods available. SQL would be ideal for what you are trying to do. Try using SQLite (a_sampdb.inc)
@ATGOggy: It takes time to learn SQL. Doesn't mean you should resort to awful methods.
Re: Load All .ini file with dini? -
ATGOggy - 18.04.2015
You should not use dini but you can use y_ini. INI is the easiest way than SQL. Read my signature.
Re: Load All .ini file with dini? -
Bakr - 18.04.2015
It's still not ideal for what he's trying to do. Why not have a single query that would return everything he needs?
Re: Load All .ini file with dini? -
ATGOggy - 18.04.2015
To do anything in SQL, you'll have to learn SQL which is not needed if you are using INI.
AW: Load All .ini file with dini? -
semara123 - 18.04.2015
here is the code
Quote:
stock LoadLabels()
{
new bool:Finished;
for(new i=0; !Finished; i++)
{
new string[128];
format(string, sizeof(string), "/Label/label%d.ini", i);
if(fexist(string))
{
CreateDynamic3DTextLabel(dini_Int(string, "text"), 0xFFFFFFFF, dini_Float(string, "x"), dini_Float(string, "y"), dini_Float(string, "z"), 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);//error in this line
}
else
{
Finished=true;
}
}
}
|
but i got this error
Quote:
error 035: argument type mismatch (argument 1)
|
sry for my bad english
Re: Load All .ini file with dini? -
Jefff - 18.04.2015
pawn Код:
stock LoadLabels()
{
new str[128],len,File:F;
new text[128],Float:Pos[3],idx;
for(new i=0; i < 100; i++)
{
format(str, 20, "/Label/label%d.ini", i);
F = fopen(str, io_read);
if(!F) break; // or continue;
idx = 0;
while((len = fread(F,str)))
{
if(len > 1)
str[len - 2] = EOS;
if((len = strfind(str,"=",true)) != -1)
{
switch(++idx)
{
case 1: strcat((text[0]=EOS,text),str[len+1]);
case 2..4: Pos[idx-2] = floatstr(str[len+1]);
default:
{
CreateDynamic3DTextLabel(text, 0xFFFFFFFF, Pos[0], Pos[1], Pos[2], 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
break;
}
}
}
}
fclose(F);
}
}