Posts: 977
Threads: 10
Joined: Apr 2011
Reputation:
0
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.
Posts: 850
Threads: 29
Joined: Sep 2014
Reputation:
0
You should not use dini but you can use y_ini. INI is the easiest way than SQL. Read my signature.
Posts: 977
Threads: 10
Joined: Apr 2011
Reputation:
0
It's still not ideal for what he's trying to do. Why not have a single query that would return everything he needs?
Posts: 850
Threads: 29
Joined: Sep 2014
Reputation:
0
To do anything in SQL, you'll have to learn SQL which is not needed if you are using INI.
Posts: 2,593
Threads: 34
Joined: Dec 2007
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);
}
}