Search for a file - 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: Search for a file (
/showthread.php?tid=157617)
Search for a file -
KnooL - 07.07.2010
Kinda simple and fast explanatory;
How to search for a file in the scriptfiles folder?
E.g. : I want every account to be found so I can open them all afterwards, easy for setting variables for every account.
- KnooL
Re: Search for a file -
dice7 - 07.07.2010
This is not possible except by generating random file names and checking if they exist (
https://sampwiki.blast.hk/wiki/Fexist ). Set all the values you need to at account creation or have a list where you store all account file names and then read them from that list
Re: Search for a file -
[DK]JaloNik - 07.07.2010
Yeah it's impossible. You should know that, Zir KnooL! You have FAILED! FAILED!
Re: Search for a file -
KnooL - 07.07.2010
Quote:
Originally Posted by JaloNik
Yeah it's impossible. You should know that, Zir KnooL! You have FAILED! FAILED!
|
fuck ur spam nikolaj
Re: Search for a file -
CAR - 07.07.2010
It isn't impossible, is it?
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], tmp[256], Pfile[50], idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/searchfile", true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, 0xFF0000, "Usage: /searchfile [filename]");
new search = strval(tmp);
format(Pfile, sizeof(Pfile), "Users/%s.txt", search); // or whatever your user files are
if(fexists(Pfile)) return SendClientMessage(playerid, 0xFF0000, "The file exists!");
if(!fexists(Pfile)) return SendClientMessage(playerid, 0xFF0000, "The file doesn't exists!");
return 1;
}
}
Not tested
Re: Search for a file -
KnooL - 07.07.2010
The server is supposed to browse and list the files in the folder for setting variables of each file.
Thanks anyway.
Re: Search for a file -
CAR - 07.07.2010
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], Pfile[50], idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/searchfiles", true))
{
SendClientMessage(playerid, 0xFF0000, "User Files:");
new Msg[40];
for(new search[MAX_PLAYER_NAME]; search < MAX_PLAYER_NAME; search++)
{
format(Pfile, sizeof(Pfile), "Users/%s.txt", search); // or whatever your user files are
format(Msg, sizeof(Msg), "Founded: %s");
SendClientMessage(playerid, 0xFF0000, Msg);
}
return 1;
}
}
It will list like:
Код:
Founded: 111
Founded: 234
Founded: 542
But I don't know how to find names, well I know, if the player is in the server...