A few problem - 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: A few problem (
/showthread.php?tid=232333)
A few problem -
blackwave - 27.02.2011
How do I search on a folder? as I did:
pawn Код:
#define local "system/%d.ini"
It's the folder/file directory. And you can search for vehicles or players:
pawn Код:
for(new v; v < MAX_VEHICLES; v++)
for(new v; v < MAX_PLAYERS; v++)
But how do I do that for those files? such as:
pawn Код:
for(new v; v < MAX_FILES; v++)
AW: A few problem -
Nero_3D - 27.02.2011
you could try to create all possible string combinations and check if they exist with fexist
But this would be an immense effort which could be done with some plugins on an easier way
But I think these plugins arent needed since you know how the file is called
You only need a pattern so the script can recognize them
Re: A few problem -
blackwave - 27.02.2011
Give me a example, please.
AW: A few problem -
Nero_3D - 27.02.2011
lets say you search for a player file, than you use some pattern for like like PlayerName.txt
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
strcat(name, ".txt", MAX_PLAYER_NAME);
if(fexist(name)) {}
or you got some maps and dont know if the map exist
pawn Код:
new name[16];
format(name, sizeof name, "Map_%d.txt", mapid);
if(fexist(name)) {}
or just tell me why you need to search in a folder for some random files?
If you want to create a command which list all registered players as example
Than you only need to create an extra file which stores all names