Check 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: Check files (
/showthread.php?tid=584544)
Check files -
Fancy - 05.08.2015
How can i make a function the checkes all the files in a folder for a string like "Account_ID = 123456"
Re: Check files -
Moudix - 05.08.2015
What do you use for saving/loading, dini or y_ini?
Re: Check files -
jamesbond007 - 05.08.2015
you cant without using plugins
Re: Check files -
Mariciuc223 - 05.08.2015
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
Re: Check files -
Fancy - 05.08.2015
i use dini and y_ini both
Re: Check files -
xVIP3Rx - 05.08.2015
You wanna search for a file or value inside some file ?
Re: Check files -
Fancy - 05.08.2015
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
Re: Check files -
xVIP3Rx - 05.08.2015
Loop through them, load each, get the string, check if it equals whatever and close/open the next file
Re: Check files -
Fancy - 05.08.2015
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 i = 0; i < /*what can i add here for file ?*/; i++)
Re: Check files -
xVIP3Rx - 05.08.2015
maybe an average for files, or the number of registered players..
Re: Check files -
PMH - 06.08.2015
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.