02.09.2013, 04:26
pawn Код:
stock INI_Get(filename[], key[])
{
new File:F,string[128];
new sname[24],sval[24];
F = fopen(filename,io_read);
if(!F) return sname;
while(fread(F,string))
{
sscanf(string,"p<=>s[24]s[24]",sname,sval);
new l = strlen(sname);
new i = 1;
while(sname[l-i] == ' ') sname[l-i++] = 0;
if(!strcmp(sname,key))
{
i = 0;
while(sval[i] == ' ') i++;
strdel(sval, 0, i);
fclose(F);
return sval;
}
}
fclose(F);
sname[0] = '\0';
return sname;
}