remove line from .ini
#1

hey guys I tried a lot to check out what is the problem in my GM I cannot unban someone with the command the I put it in FS and still doesn't work.
Discription of what it need to do:
the code need to remove "Locked=2\n"
and to write "Locked=0\n"
and it's just writed the "Locked=0\n" with the "Locked=2\n"
here is the FS I made for it:
http://pastebin.com/WHyVMbCS

thanks for the helpers!!!
Reply
#2

there is an idea:
you can read the whole file, and when you get to the value you want to delete you skipping it.
then you remove the file and create a new one with the new content.
edit: i see you using dini... just use dini_Unset.
Reply
#3

can't it destroy my account's file
for example player's file it like this
level=1money=1
and when I use dini_Unset it's like this
level=1
money=1
and it can't read the file after it understand?
Reply
#4

Quote:
Originally Posted by xDeadlyBoy
Посмотреть сообщение
there is an idea:
you can read the whole file, and when you get to the value you want to delete you skipping it.
then you remove the file and create a new one with the new content.
edit: i see you using dini... just use dini_Unset.
You should have looked at the code, the OP doesn't use it - he just includes it.

Quote:

can't it destroy my account's file
for example player's file it like this
level=1money=1
and when I use dini_Unset it's like this
level=1
money=1
and it can't read the file after it understand?

dini_Unset removes a file, so you don't want to do that.

Dini also would corrupt the file to how Godfather reads character files (assuming you're using the same method or the same code), simply because Dini uses '\r\n' for newlines, and Godfather only uses '\n' for newlines. You could probably modify the Dini include to remove the '\r' so it'll work.
Reply
#5

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
You should have looked at the code, the OP doesn't use it - he just includes it.



dini_Unset removes a file, so you don't want to do that.

Dini also would corrupt the file to how Godfather reads character files (assuming you're using the same method or the same code), simply because Dini uses '\r\n' for newlines, and Godfather only uses '\n' for newlines. You could probably modify the Dini include to remove the '\r' so it'll work.
can you just like make me something like this?
edit: I have changed let's see if it works!

edit: still not it just romoves it and destroy the file it make it like
level=1
money=1
what do I have to do?
Reply
#6

fixed it I took from dini and dutiles and it fixed!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)