[Help] Editing txt files
well i'm creating a plugin which save the top 5 only scorers(soccerjam) in a txt file in this format:
PHP Code:
PHP Code:
do i need to delete this line and re-add it edited or there is a better way to do it? for example if someone score and he is one of the top 5. Automaticly update the txt where is steamid. |
Re: [Help] Editing txt files
You can either replace an entire line or just overwrite the data/# being updated. Easiest would be replacing the entire line IMO. Why not use nvault?
You can take a look here http://forums.alliedmods.net/showthread.php?t=104681 |
Re: [Help] Editing txt files
wow, that was a fast respond. thank you anyway, i will try it and test it a few time :D
edit: if i have a textfile like this: PHP Code:
PHP Code:
PHP Code:
|
Re: [Help] Editing txt files
nvault would be much easier :)
|
Re: [Help] Editing txt files
Yes, the third param specifies which line the data is written to; it will overwrite old data if data exists. Im not sure off the top of my head if line 1 is referenced with 0 or 1. Use -1 to append the line to the end of file. Just use nvault unless you need to manually edit this file with notepad or w/e.
|
Re: [Help] Editing txt files
ok, thank you very much. nvault isn't an option for me, nvault can't perform what i want it to do.
|
Re: [Help] Editing txt files
o.o What are you trying to do, if you don't mind my asking?
|
Re: [Help] Editing txt files
i will tell you, i solved it anyway. I'm trying to get the top5 scores(soccerjam server) and update their goals life time. I don't want to use nvault, i have my reasons.
|
Re: [Help] Editing txt files
Okay. Fair enough.
|
Re: [Help] Editing txt files
If you don't want to use nvault because of preference just say so. If you have valid reasons not to use it I am interested why.
|
| All times are GMT -4. The time now is 07:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.