01.01.2012, 21:09
hi I wanna know if samp have fuction who return number of file in directory, thx and sorry or bad english.
GetFreeFileSlot( ) {
new
FileName[ 20 ],
Slot = 0; // Or minumum file number.
for( new i = 0; i < MAX_FILE_NUMBER; i++ ) { //Loop from zero to whatever MAX_FILE_NUMBER you set
format( FileName, sizeof( FileName ), FILE_PATH "File_%d.ini", i );
if( fexist( FileName )) Slot++; // If slot exists, continue...
else break; // If slot doesn't exist, break the loop and...
}
return Slot; // ...return the value
}

new File:fFireworksCat=fopen("FireworksCat.txt",io_readwrite);
while(fread(fFireworksCat,ValCat))
{
if(!sscanf(ValCat,"d",Type))
{
format(filename,sizeof(filename),"Fireworks/%05d.txt",Type);
new File:fFireworks=fopen(filename,io_readwrite);