SA-MP Forums Archive
remove line from .ini - 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: remove line from .ini (/showthread.php?tid=258111)



remove line from .ini - vladi866 - 29.05.2011

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!!!


Re: remove line from .ini - xDeadlyBoy - 29.05.2011

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.


Re: remove line from .ini - vladi866 - 29.05.2011

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?


Re: remove line from .ini - Calgon - 29.05.2011

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.


Re: remove line from .ini - vladi866 - 29.05.2011

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?


Re: remove line from .ini - vladi866 - 29.05.2011

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