19.06.2011, 07:37
Can you add this functions ?:
For example we have 5 files in directory "mydir" called: file1, lolfile, xfile, nyanfile, evilfile
Function GetFileInDirectoryByIndex will be return this file names by index:
did you understand ?
pawn Код:
GetFileInDirectoryByIndex(index,dir[], return_filename[], len);
CountFilesInDirectory(dir[]);
Function GetFileInDirectoryByIndex will be return this file names by index:
pawn Код:
EXAMPLE 1:
GetFileInDirectoryByIndex(1,"mydir") = file1
GetFileInDirectoryByIndex(2,"mydir") = lolfile
GetFileInDirectoryByIndex(3,"mydir") = xfile
GetFileInDirectoryByIndex(4,"mydir") = nyanfile
GetFileInDirectoryByIndex(5,"mydir") = evilfile
pawn Код:
EXAMPLE 2:
new fname[50];
for(new f = 1; f < CountFilesInDirectory("mydir"); f++)
{
GetFileInDirectoryByIndex(f,"mydir", fname, sizeof(fname));
printf("File index:%d name:%s",f,fname);
}