Check files
#1

How can i make a function the checkes all the files in a folder for a string like "Account_ID = 123456"
Reply
#2

What do you use for saving/loading, dini or y_ini?
Reply
#3

you cant without using plugins
Reply
#4

If the name of file it's "123456" you can use a loop .

Код:
for(new i, str[128]; i++)
{
      format(str, sizeof(str), "Accounts/%i.ini", i); // format the file
      if(fexist(AccountID(i))) // check if file exist
      {
            // Do stuff
      }
      else break;
}
When a player create an account to set 1 , 2 , 3 in a row .. if you do account id 1 before 3 , the loop will break
Reply
#5

i use dini and y_ini both
Reply
#6

You wanna search for a file or value inside some file ?
Reply
#7

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
You wanna search for a file or value inside some file ?
i want to search a string from all files which contain in a folder
Reply
#8

Loop through them, load each, get the string, check if it equals whatever and close/open the next file
Reply
#9

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
Loop through them, load each, get the string, check if it equals whatever and close/open the next file
PHP код:
for(new 0/*what can i add here for file ?*/i++) 
Reply
#10

maybe an average for files, or the number of registered players..
Reply
#11

I would suggest making another separate .ini file saving all players names with their ids, and when u want to check all the files, first load that single ini get all names from it and then load each one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)