File Load
#1

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?
Reply
#2

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

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".
Reply
#4

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

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

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

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
Reply
#8

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

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)