SA-MP Forums Archive
Adding new strings to an existing INI 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)
+--- Thread: Adding new strings to an existing INI file (/showthread.php?tid=425471)



Adding new strings to an existing INI file - rhds - 25.03.2013

For example, my current example.ini user file has following data:

Код:
Username = example
Password = example
Skin = 123
If I wish to add a new string, for example, "AdminLevel", would I have to delete example.ini in order to update it trough the script?


Re: Adding new strings to an existing INI file - Scenario - 25.03.2013

Which file system are you using?


Re: Adding new strings to an existing INI file - rhds - 25.03.2013

I'm using y_ini.


Re: Adding new strings to an existing INI file - Scenario - 25.03.2013

Here's an example of writing data to an INI file with y_ini:

pawn Код:
new INI:ini = INI_Open("myini.ini");
INI_SetTag(ini, "LVDM");
INI_WriteString(ini, "NAME", "******");
INI_WriteInt(ini, "SCORE", gScore);
INI_Close(ini);
So as you can see, you're basically doing the following:

opening the file
writing a string
writing an integer
closing the file



Re: Adding new strings to an existing INI file - Glad2BeHere - 25.03.2013

https://sampforum.blast.hk/showthread.php?tid=273088 learn.........


Re: Adding new strings to an existing INI file - rhds - 25.03.2013

Thank you, RealCop228.