users.txt, How wood i read and write in it? -
DeadAhead - 22.08.2010
Ok , lets say i made users.txt in my scripfiles and then i would want something like this
Код:
Username,Password,Adminlevel,Score
and so on so that it saves stats. I know how to make the saving e.t.c, but how do i make a list like that and read from it?
like...
and put that in one List variable?
Re: users.txt, How wood i read and write in it? -
Jochemd - 22.08.2010
That is impossible,you can only have it like this:
var1
var2
var3
Re: users.txt, How wood i read and write in it? -
DeadAhead - 22.08.2010
Actually im pretty sure i saw it in a script. i done some research but didnt find anything. so im sure its possible some way. Like multiple lines with
Код:
Var1,String1,String1,Var1
(Example) and then read all of em
Re: users.txt, How wood i read and write in it? -
Voldemort - 22.08.2010
You can make one line but that it will be hard to overview, when you will need to edit some stuffs manual.
Im sure that on this forum there have many stats saving tutorials
Re: users.txt, How wood i read and write in it? -
bigcomfycouch - 22.08.2010
It's possible, but a bad idea. You would have to loop through every line of the file preceding somebody's player information, which could possibly cause a hang.
Re: users.txt, How wood i read and write in it? -
DeadAhead - 22.08.2010
Yeah well i atent to use it for 'admins.txt'
Re: users.txt, How wood i read and write in it? -
Vince - 22.08.2010
Lolz, just use sscanf for that.
Re: users.txt, How wood i read and write in it? -
DeadAhead - 22.08.2010
Im kinda not a pro, can you pl0x show a example?
Re: users.txt, How wood i read and write in it? -
Vince - 22.08.2010
Basic:
pawn Код:
new
var1,
var2,
var3;
new resultline[256];
fread(file, resultline);
sscanf(resultline, "p<,>iii", var1, var2, var3);
If you use an enum for your data, it can be done even simpler (requires the sscanf2 plugin, though).
Please read the sscanf topic here:
https://sampforum.blast.hk/showthread.php?tid=120356
Re: users.txt, How wood i read and write in it? -
DeadAhead - 22.08.2010
hmm. Thanks!