Check all players ini
#1

I'm trying to find a way to open all the files .Ini. How can I do?


stock PlayerFile(name[]){
new string[50];
format(string,sizeof(string),"Players/%s.ini",name);
return string;
}

I need to know the name

Thanks...
Reply
#2

If you want to do it in pure PAWN (without a plugin or external program) then the only solution is, each time you create a .ini file, you write the name of that file in another file, then use this file to get all the files names.
Reply
#3

Need not be in pawn I just need to get all the files from the folder Players to be modified.
Reply
#4

Create a new text file in your scriptfiles folder, then type in it:
Код:
dir /b Players > list_of_players_files.txt
then rename as .cmd and run it.

This will create a file "list_of_players_files.txt" in your scriptfiles folder which will contain the names of all files inside the Players folder. Then use this file in PAWN.
Reply
#5

Thanks! Nice! but how I get the names? using the lines?
Reply
#6

Yes.

Ex:
pawn Код:
new File:f = fopen("list_of_players_files.txt", io_read), s[32];
   
while(fread(f, s))
  printf("Current player file name: %s", s);
   
fclose(f);
You may need to delete the "\n" or "\r\n" that is placed at the end of each lines, to make a valid file name.
Reply
#7

It did not work, not appear in console. Thanks again! :P

Код:
new File:f = fopen("list_of_players_files.txt", io_read), s[32];
while(fread(f, s, sizeof s)){
   printf("Current player file name: %s", s);
}
fclose(f);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)