SA-MP Forums Archive
Check all players ini - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check all players ini (/showthread.php?tid=109069)



Check all players ini - Marshew_DD - 17.11.2009

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...


Re: Check all players ini - yom - 17.11.2009

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.


Re: Check all players ini - Marshew_DD - 17.11.2009

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


Re: Check all players ini - yom - 17.11.2009

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.


Re: Check all players ini - Marshew_DD - 17.11.2009

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


Re: Check all players ini - yom - 17.11.2009

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.


Re: Check all players ini - Marshew_DD - 17.11.2009

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);