How to change a line string in a file - 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: How to change a line string in a file (
/showthread.php?tid=178327)
How to change a line string in a file -
Claude - 21.09.2010
Like, you have this:
scriptfiles/count_stats.ini
pawn Код:
players alive: 34
players death: 6
How to change the line with;
players alive: 34
Re: How to change a line string in a file -
Mauzen - 21.09.2010
You would need random access to change a specific line only, but fwrite does only support sequential.
A possibility (without plugins, if there are some for RA) would be to read the whole file line-by-line, look for the players alive line, change it (the variable containing it) and rewrite the whole file.
You could also use a ini fs, it does almost the same.
Re: How to change a line string in a file -
Claude - 21.09.2010
But how does iClone it? He doesn't change a string anywhere :P
Re: How to change a line string in a file -
Conroy - 21.09.2010
Use
DINI. It's easier to edit.
It would read:
Alive=34
Dead=6
You can then edit each record with one line of code.
Re: How to change a line string in a file -
Grim_ - 21.09.2010
Not dini, djSon seeing how it's much faster and stable (And seeing how it was made as "dini2").