SA-MP Forums Archive
File Load - 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: File Load (/showthread.php?tid=82445)



File Load - Ribber - 18.06.2009

Hey,
i would to make a stock who load the users who registered on my server (only for test)
i dont know how its work...
i think its work like this:
pawn Код:
format(string, sizeof(string), "/Users/%s.txt", ???);
can me any1 post a code?


Re: File Load - Grim_ - 18.06.2009

I don't quite understand what you're trying to do here, please explain more.


Re: File Load - Ribber - 18.06.2009

example: i write in the server "/users" and than comes the list from the files in the "/Users/%s/" folder.

i dont know how i can load the "%s".


Re: File Load - HB - 18.06.2009

https://sampwiki.blast.hk/wiki/Format <- Read this and you'll understand.


Re: File Load - Ribber - 18.06.2009

no i dont understand or rather i understand format.
my question are, HOW i can load the files from the folder.


Re: File Load - Grim_ - 18.06.2009

if I understand correctly: https://sampwiki.blast.hk/wiki/File_Functions


Re: File Load - Ribber - 18.06.2009

Quote:
Originally Posted by Swift_
u mean https://sampwiki.blast.hk/wiki/File_Functions right?
yes i understand to.
my question are: for example gangs id load work like this:

pawn Код:
for(new i = 0; i < MAX_GANGS; i++)
{
format(string, sizeof(string), "/Gangs/%d.txt", i);
}
(only example, cause nobody understand me )

okay, but how can i load users like this?

with

pawn Код:
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
format(string, sizeof(string), "/Users/%s.txt", i);
}
dont work...

i hope now you understand


Re: File Load - Grim_ - 18.06.2009

You would use something like this
pawn Код:
new name[24];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof string, "/Users/%s.txt", name);



Re: File Load - HB - 18.06.2009

Get the players name instead of creating a loop. You're like creating a loop of 24, and trying to get that. Basicly you're trying to load Users/0-24.


Re: File Load - Ribber - 18.06.2009

Quote:
Originally Posted by Swift_
You would use something like this
pawn Код:
new name[24];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string, sizeof string, "/Users/%s.txt", name);
yes, but when the server starts, with:

pawn Код:
public OnGameModeInit()
{
    LoadUser();
    return 1;
}
then are the "name" variable disappeared