SA-MP Forums Archive
Opening files - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Opening files (/showthread.php?tid=591376)



Opening files - cdoubleoper - 11.10.2015

Hey. I wanna open all files that exist in folder which are named by numbers - but it ain't work. What's wrong?

Код:
	new string[64];
	new File:item;
	for(new i = 0; i < MAX_ITEMS; i++){
	    if(item){
			format(string, sizeof(string), "scriptfiles\\items\\%i.ini", i);
		    item=fopen(string, io_read);
		    printf("file %i", i);}}



Re: Opening files - AbyssMorgan - 11.10.2015

PHP код:
new string[64];
new 
File:item;
for(new 
0MAX_ITEMSi++){
    
format(stringsizeof(string), "/items/%i.ini"i); //in scriptfiles
    
if(fexist(string)){
        
item fopen(stringio_read);
        
printf("file %i"i);
    }




Re: Opening files - cdoubleoper - 11.10.2015

Awesome, thank you.