SA-MP Forums Archive
How do i read this...? - 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)
+--- Thread: How do i read this...? (/showthread.php?tid=527156)



How do i read this...? - Sojo12 - 21.07.2014

How do I read information from a file starting at a certain line?
Sorry for having not posted any code.But how do i..


Re: How do i read this...? - Twizted - 21.07.2014

Well, and we are meant to guess what saving system you are using?


Re: How do i read this...? - Sojo12 - 21.07.2014

You can use "fread" to start at a position.But it will lag!!
EDIT:@Twizted,i'm using Y_INI


Re: How do i read this...? - Sawalha - 21.07.2014

pawn Код:
INI_Int("Score", pInfo[playerid][Score]); // integer
INI_String("Name", pInfo[playerid][Name]); // name
INI_Float("PosX", pInfo[playerid][pX]); // float
Note : you must have the tag of variable you want to read in ini file

Код:
Score: 505
Name: Marquis
Px: 998796126.241
like that


Re: How do i read this...? - Sojo12 - 23.07.2014

Sorry for late reply.
OT:I have a command (/registeredplayers) which lists all players that have registered on the server within pages. 20 per page. There's about 166,666 registered players, and once the page count is on like 300 it takes a while to read the file. How could I start at a certain line to stop the delay?


Re: How do i read this...? - Virtual1ty - 23.07.2014

No other way then fseek I'm afraid, in combination with fgetchar. But then you'll be reading char-by-char which is inefficient as hell.
You should've converted to relational database years ago when you saw you're going to get lots of players registering... Why list it in-game anyways? Just get the filename and print it in a website or something...


Re: How do i read this...? - Sojo12 - 26.07.2014

Thank you for your reply.I'll try doing something with it and let you know the results.I hope it works this time!