21.09.2013, 14:56
Quote:
|
How may i count files in a folder? I did this and it is not working
![]() Код:
stock NumFiles(type2)
{
new string[50];
if(type2 == 1) format(string, sizeof(string), "Vehicles/normal/");
else if(type2 == 3) format(string, sizeof(string), "Vehicles/personal/");
else if(type2 == 4) format(string, sizeof(string), "Vehicles/faction/");
else if(type2 == 5) format(string, sizeof(string), "Vehicles/job/");
else if(type2 == 6) format(string, sizeof(string), "Vehicles/biz/");
new dir:dHandle = dir_open(string);
new item[40], type, contor = -1;
while(dir_list(dHandle, item, type))
{
if(type == FM_FILE) contor++;
}
dir_close(dHandle);
return contor;
}
|
Код:
stock NumFiles(type2)
{
new string[50];
if(type2 == 1) format(string, sizeof(string), "scriptfiles/Vehicles/normal/");
else if(type2 == 3) format(string, sizeof(string), "scriptfiles/Vehicles/personal/");
else if(type2 == 4) format(string, sizeof(string), "scriptfiles/Vehicles/faction/");
else if(type2 == 5) format(string, sizeof(string), "scriptfiles/Vehicles/job/");
else if(type2 == 6) format(string, sizeof(string), "scriptfiles/Vehicles/biz/");
new dir:dHandle = dir_open(string);
new item[40], type, contor = -1;
while(dir_list(dHandle, item, type))
{
if(type == FM_FILE) contor++;
}
dir_close(dHandle);
return contor;
}



